diff options
-rw-r--r-- | XMonad/Config/Droundy.hs | 30 | ||||
-rw-r--r-- | XMonad/Hooks/UrgencyHook.hs | 1 |
2 files changed, 26 insertions, 5 deletions
diff --git a/XMonad/Config/Droundy.hs b/XMonad/Config/Droundy.hs index 8ce000d..24de457 100644 --- a/XMonad/Config/Droundy.hs +++ b/XMonad/Config/Droundy.hs @@ -8,13 +8,13 @@ module XMonad.Config.Droundy ( config, mytab ) where --- --- Useful imports --- +import Control.Monad.State ( modify ) + import XMonad hiding (keys, config) import qualified XMonad (keys) import XMonad.Config ( defaultConfig ) +import XMonad.Core ( windowset ) import XMonad.Layouts hiding ( (|||) ) import XMonad.Operations import qualified XMonad.StackSet as W @@ -45,6 +45,9 @@ import XMonad.Actions.CopyWindow import XMonad.Actions.DynamicWorkspaces import XMonad.Actions.RotView +import XMonad.Hooks.ManageDocks +import XMonad.Hooks.UrgencyHook + myXPConfig :: XPConfig myXPConfig = defaultXPConfig {font="-*-lucida-medium-r-*-*-14-*-*-*-*-*-*-*" ,height=22} @@ -127,11 +130,11 @@ keys x = M.fromList $ ++ zip (zip (repeat (modMask x .|. shiftMask)) [xK_F1..xK_F12]) (map (withNthWorkspace copy) [0..]) -config = defaultConfig +config = withUrgencyHook FocusUrgencyHook $ defaultConfig { borderWidth = 1 -- Width of the window border in pixels. , XMonad.workspaces = ["1:mutt","2:iceweasel"] , layoutHook = workspaceDir "~" $ windowNavigation $ - toggleLayouts (noBorders Full) $ -- avoidStruts $ + toggleLayouts (noBorders Full) $ avoidStruts $ Named "tabbed" (noBorders mytab) ||| Named "xclock" (mytab ****//* combineTwo Square mytab mytab) ||| Named "widescreen" ((mytab *||* mytab) @@ -167,3 +170,20 @@ dropFromTail t s | drop (length s - length t) s == t = Just $ take (length s - l dropFromHead :: String -> String -> Maybe String dropFromHead h s | take (length h) s == h = Just $ drop (length h) s | otherwise = Nothing + +data FocusUrgencyHook = FocusUrgencyHook deriving (Read, Show) + +instance UrgencyHook FocusUrgencyHook Window where + urgencyHook _ w = modify copyAndFocus + where copyAndFocus s + | Just w == W.peek (windowset s) = s + | has w $ W.stack $ W.workspace $ W.current $ windowset s = + s { windowset = until ((Just w ==) . W.peek) + W.focusUp $ windowset s } + | otherwise = + let t = W.tag $ W.workspace $ W.current $ windowset s + in s { windowset = until ((Just w ==) . W.peek) + W.focusUp $ copyWindow w t $ windowset s } + has _ Nothing = False + has x (Just (W.Stack t l rr)) = x `elem` (t : l ++ rr) + diff --git a/XMonad/Hooks/UrgencyHook.hs b/XMonad/Hooks/UrgencyHook.hs index 135a746..61c30b3 100644 --- a/XMonad/Hooks/UrgencyHook.hs +++ b/XMonad/Hooks/UrgencyHook.hs @@ -25,6 +25,7 @@ module XMonad.Hooks.UrgencyHook ( urgencyLayoutHook, NoUrgencyHook(..), StdoutUrgencyHook(..), dzenUrgencyHook, DzenUrgencyHook(..), + UrgencyHook(urgencyHook), seconds ) where |