mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-10 17:52:09 -07:00
Truncate long window titles
This commit is contained in:
@@ -29,7 +29,7 @@ module XMonadContrib.DynamicLog (
|
|||||||
pprWindowSetXinerama,
|
pprWindowSetXinerama,
|
||||||
|
|
||||||
PP(..), defaultPP, sjanssenPP,
|
PP(..), defaultPP, sjanssenPP,
|
||||||
wrap, xmobarColor
|
wrap, xmobarColor, shorten
|
||||||
) where
|
) where
|
||||||
|
|
||||||
--
|
--
|
||||||
@@ -128,6 +128,12 @@ wrap :: String -> String -> String -> String
|
|||||||
wrap l r "" = ""
|
wrap l r "" = ""
|
||||||
wrap l r m = l ++ m ++ r
|
wrap l r m = l ++ m ++ r
|
||||||
|
|
||||||
|
shorten :: Int -> String -> String
|
||||||
|
shorten n xs | length xs < n = xs
|
||||||
|
| otherwise = (take (n - length end) xs) ++ end
|
||||||
|
where
|
||||||
|
end = "..."
|
||||||
|
|
||||||
sepBy :: String -> [String] -> String
|
sepBy :: String -> [String] -> String
|
||||||
sepBy sep = concat . intersperse sep . filter (not . null)
|
sepBy sep = concat . intersperse sep . filter (not . null)
|
||||||
|
|
||||||
@@ -153,7 +159,7 @@ defaultPP = PP { ppCurrent = wrap "[" "]"
|
|||||||
, ppHiddenNoWindows = const ""
|
, ppHiddenNoWindows = const ""
|
||||||
, ppSep = " : "
|
, ppSep = " : "
|
||||||
, ppWsSep = " "
|
, ppWsSep = " "
|
||||||
, ppTitle = const ""
|
, ppTitle = shorten 50
|
||||||
, ppLayout = id
|
, ppLayout = id
|
||||||
, ppOrder = id }
|
, ppOrder = id }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user