diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-09-03 13:43:11 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-09-03 13:43:11 +0200 |
commit | 01a381911a2ce989c9e9e5ff470ff67f16a4a4f7 (patch) | |
tree | 53c943f56e118407914f5dc0b8115c12cfd4a7d6 /lib | |
parent | 6ce8a6515eba6b979095efe30eaa7c978e16a27f (diff) | |
download | xmonad-conf-01a381911a2ce989c9e9e5ff470ff67f16a4a4f7.tar xmonad-conf-01a381911a2ce989c9e9e5ff470ff67f16a4a4f7.zip |
Adjusted EwmhDesktops module
Diffstat (limited to 'lib')
-rw-r--r-- | lib/DynamicPerScreenWorkspaces.hs | 10 | ||||
-rw-r--r-- | lib/EwmhDesktops.hs | 27 |
2 files changed, 26 insertions, 11 deletions
diff --git a/lib/DynamicPerScreenWorkspaces.hs b/lib/DynamicPerScreenWorkspaces.hs index 263174d..66bbf11 100644 --- a/lib/DynamicPerScreenWorkspaces.hs +++ b/lib/DynamicPerScreenWorkspaces.hs @@ -6,6 +6,7 @@ module DynamicPerScreenWorkspaces ( screenWorkspaceStorage , dynamicRescreenHook , create , cleanup + , focusWindow , view , viewOn , viewOnCurrent @@ -128,6 +129,15 @@ create conf i = do cleanup :: X () cleanup = windows cleanup' +focusWindow :: DynamicWorkspaceConfig -> Window -> X () +focusWindow conf w = do + wset <- gets windowset + let mws = W.findTag w wset + whenJust mws $ \ws -> do + let i = head $ filter ((== ws) . workspaceTag conf) [0..] + sid <- workspaceScreen conf i + windows' $ liftM (cleanup' . W.focusWindow w) . viewOn' conf sid i + view :: DynamicWorkspaceConfig -> Int -> X () view conf i = do sid <- workspaceScreen conf i diff --git a/lib/EwmhDesktops.hs b/lib/EwmhDesktops.hs index 334233d..12b1688 100644 --- a/lib/EwmhDesktops.hs +++ b/lib/EwmhDesktops.hs @@ -36,6 +36,8 @@ import XMonad.Util.XUtils (fi) import XMonad.Util.WorkspaceCompare import XMonad.Util.WindowProperties (getProp32) +import DynamicPerScreenWorkspaces + -- $usage -- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@: -- @@ -48,10 +50,10 @@ import XMonad.Util.WindowProperties (getProp32) -- | Add EWMH functionality to the given config. See above for an example. -ewmh :: XConfig a -> XConfig a -ewmh c = c { startupHook = startupHook c +++ ewmhDesktopsStartup - , handleEventHook = handleEventHook c +++ ewmhDesktopsEventHook - , logHook = logHook c +++ ewmhDesktopsLogHook } +ewmh :: DynamicWorkspaceConfig -> XConfig a -> XConfig a +ewmh dwc c = c { startupHook = startupHook c +++ ewmhDesktopsStartup + , handleEventHook = handleEventHook c +++ ewmhDesktopsEventHook dwc + , logHook = logHook c +++ ewmhDesktopsLogHook } where x +++ y = mappend x y -- | @@ -105,11 +107,11 @@ ewmhDesktopsLogHook = withWindowSet $ \s -> do -- -- * _NET_ACTIVE_WINDOW (activate another window, changing workspace if needed) -- -ewmhDesktopsEventHook :: Event -> X All -ewmhDesktopsEventHook e = handle e >> return (All True) +ewmhDesktopsEventHook :: DynamicWorkspaceConfig -> Event -> X All +ewmhDesktopsEventHook dwc e = handle dwc e >> return (All True) -handle :: Event -> X () -handle ClientMessageEvent { +handle :: DynamicWorkspaceConfig -> Event -> X () +handle dwc ClientMessageEvent { ev_window = w, ev_message_type = mt, ev_data = d @@ -125,7 +127,9 @@ handle ClientMessageEvent { if mt == a_cd then do let n = head d if 0 <= n && fi n < length ws then - windows $ W.view (W.tag (ws !! fi n)) + --windows $ W.view (W.tag (ws !! fi n)) + --view dwc $ fi n + return () else trace $ "Bad _NET_CURRENT_DESKTOP with data[0]="++show n else if mt == a_d then do let n = head d @@ -133,7 +137,8 @@ handle ClientMessageEvent { windows $ W.shiftWin (W.tag (ws !! fi n)) w else trace $ "Bad _NET_DESKTOP with data[0]="++show n else if mt == a_aw then do - windows $ W.focusWindow w + --windows $ W.focusWindow w + focusWindow dwc w else if mt == a_cw then do killWindow w else if mt `elem` a_ignore then do @@ -142,7 +147,7 @@ handle ClientMessageEvent { -- The Message is unknown to us, but that is ok, not all are meant -- to be handled by the window manager return () -handle _ = return () +handle _ _ = return () -- | -- An event hook to handle applications that wish to fullscreen using the |