aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Config
diff options
context:
space:
mode:
authorDavid Roundy <droundy@darcs.net>2007-11-13 17:31:16 +0100
committerDavid Roundy <droundy@darcs.net>2007-11-13 17:31:16 +0100
commitd03cac43d6d50086d55b402c431c9b801cd7c443 (patch)
tree0687650a562ad15144d0558967adf195b8fa9a2c /XMonad/Config
parent81590729fa98e13f66ea5dc0e5f92e4ee8214092 (diff)
downloadXMonadContrib-d03cac43d6d50086d55b402c431c9b801cd7c443.tar.gz
XMonadContrib-d03cac43d6d50086d55b402c431c9b801cd7c443.tar.xz
XMonadContrib-d03cac43d6d50086d55b402c431c9b801cd7c443.zip
make shrinker preserved over restart in tabbed.
darcs-hash:20071113163116-72aca-e299ebe5cb2a80daa30c526ba64305a7469d1dd6.gz
Diffstat (limited to 'XMonad/Config')
-rw-r--r--XMonad/Config/Droundy.hs22
1 files changed, 18 insertions, 4 deletions
diff --git a/XMonad/Config/Droundy.hs b/XMonad/Config/Droundy.hs
index 856db86..27e1987 100644
--- a/XMonad/Config/Droundy.hs
+++ b/XMonad/Config/Droundy.hs
@@ -1,4 +1,4 @@
-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
+{-# OPTIONS_GHC -fno-warn-missing-signatures -fglasgow-exts #-}
-----------------------------------------------------------------------------
-- |
-- Copyright : (c) Spencer Janssen 2007
@@ -6,12 +6,12 @@
--
------------------------------------------------------------------------
-module XMonad.Config.Droundy where
+module XMonad.Config.Droundy ( config, mytab ) where
--
-- Useful imports
--
-import XMonad hiding (keys)
+import XMonad hiding (keys, config)
import qualified XMonad (keys)
import XMonad.Config ( defaultConfig )
@@ -129,5 +129,19 @@ config = defaultConfig
, XMonad.modMask = mod1Mask
, XMonad.keys = keys
}
- where mytab = tabbed shrinkText defaultTConf
+mytab = tabbed CustomShrink defaultTConf
+
+instance Shrinker CustomShrink where
+ shrinkIt shr s | Just s' <- dropFromTail " " s = shrinkIt shr s'
+ shrinkIt shr s | Just s' <- dropFromTail "- Iceweasel" s = shrinkIt shr s'
+ shrinkIt _ s | n > 9 = s : map cut [2..(halfn-3)] ++ shrinkIt shrinkText s
+ where n = length s
+ halfn = n `div` 2
+ rs = reverse s
+ cut x = take (halfn - x) s ++ "..." ++ reverse (take (halfn-x) rs)
+ shrinkIt _ s = shrinkIt shrinkText s
+
+dropFromTail :: String -> String -> Maybe String
+dropFromTail t s | drop (length s - length t) s == t = Just $ take (length s - length t) s
+ | otherwise = Nothing