aboutsummaryrefslogtreecommitdiffstats
path: root/DynamicLog.hs
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-10-18 02:25:11 +0200
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-10-18 02:25:11 +0200
commit2a1b51d10f42cafa4a9efa084a8914cde8e70cb3 (patch)
treef3e2b525a323064fc897f8d930c1b849330c23bf /DynamicLog.hs
parent4854b8000e86fc2843f001ce1f4433a39a69a6dc (diff)
downloadXMonadContrib-2a1b51d10f42cafa4a9efa084a8914cde8e70cb3.tar.gz
XMonadContrib-2a1b51d10f42cafa4a9efa084a8914cde8e70cb3.tar.xz
XMonadContrib-2a1b51d10f42cafa4a9efa084a8914cde8e70cb3.zip
Truncate long window titles
darcs-hash:20071018002511-a5988-12b76a33f36ff72975d03585b68454dd1a4f8c5d.gz
Diffstat (limited to 'DynamicLog.hs')
-rw-r--r--DynamicLog.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/DynamicLog.hs b/DynamicLog.hs
index 213b997..888ed68 100644
--- a/DynamicLog.hs
+++ b/DynamicLog.hs
@@ -29,7 +29,7 @@ module XMonadContrib.DynamicLog (
pprWindowSetXinerama,
PP(..), defaultPP, sjanssenPP,
- wrap, xmobarColor
+ wrap, xmobarColor, shorten
) where
--
@@ -128,6 +128,12 @@ wrap :: String -> String -> String -> String
wrap l 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 sep = concat . intersperse sep . filter (not . null)
@@ -153,7 +159,7 @@ defaultPP = PP { ppCurrent = wrap "[" "]"
, ppHiddenNoWindows = const ""
, ppSep = " : "
, ppWsSep = " "
- , ppTitle = const ""
+ , ppTitle = shorten 50
, ppLayout = id
, ppOrder = id }