Adjusted EwmhDesktops module
This commit is contained in:
parent
6ce8a6515e
commit
01a381911a
3 changed files with 27 additions and 12 deletions
|
@ -6,6 +6,7 @@ module DynamicPerScreenWorkspaces ( screenWorkspaceStorage
|
||||||
, dynamicRescreenHook
|
, dynamicRescreenHook
|
||||||
, create
|
, create
|
||||||
, cleanup
|
, cleanup
|
||||||
|
, focusWindow
|
||||||
, view
|
, view
|
||||||
, viewOn
|
, viewOn
|
||||||
, viewOnCurrent
|
, viewOnCurrent
|
||||||
|
@ -128,6 +129,15 @@ create conf i = do
|
||||||
cleanup :: X ()
|
cleanup :: X ()
|
||||||
cleanup = windows cleanup'
|
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 :: DynamicWorkspaceConfig -> Int -> X ()
|
||||||
view conf i = do
|
view conf i = do
|
||||||
sid <- workspaceScreen conf i
|
sid <- workspaceScreen conf i
|
||||||
|
|
|
@ -36,6 +36,8 @@ import XMonad.Util.XUtils (fi)
|
||||||
import XMonad.Util.WorkspaceCompare
|
import XMonad.Util.WorkspaceCompare
|
||||||
import XMonad.Util.WindowProperties (getProp32)
|
import XMonad.Util.WindowProperties (getProp32)
|
||||||
|
|
||||||
|
import DynamicPerScreenWorkspaces
|
||||||
|
|
||||||
-- $usage
|
-- $usage
|
||||||
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
|
-- 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.
|
-- | Add EWMH functionality to the given config. See above for an example.
|
||||||
ewmh :: XConfig a -> XConfig a
|
ewmh :: DynamicWorkspaceConfig -> XConfig a -> XConfig a
|
||||||
ewmh c = c { startupHook = startupHook c +++ ewmhDesktopsStartup
|
ewmh dwc c = c { startupHook = startupHook c +++ ewmhDesktopsStartup
|
||||||
, handleEventHook = handleEventHook c +++ ewmhDesktopsEventHook
|
, handleEventHook = handleEventHook c +++ ewmhDesktopsEventHook dwc
|
||||||
, logHook = logHook c +++ ewmhDesktopsLogHook }
|
, logHook = logHook c +++ ewmhDesktopsLogHook }
|
||||||
where x +++ y = mappend x y
|
where x +++ y = mappend x y
|
||||||
|
|
||||||
-- |
|
-- |
|
||||||
|
@ -105,11 +107,11 @@ ewmhDesktopsLogHook = withWindowSet $ \s -> do
|
||||||
--
|
--
|
||||||
-- * _NET_ACTIVE_WINDOW (activate another window, changing workspace if needed)
|
-- * _NET_ACTIVE_WINDOW (activate another window, changing workspace if needed)
|
||||||
--
|
--
|
||||||
ewmhDesktopsEventHook :: Event -> X All
|
ewmhDesktopsEventHook :: DynamicWorkspaceConfig -> Event -> X All
|
||||||
ewmhDesktopsEventHook e = handle e >> return (All True)
|
ewmhDesktopsEventHook dwc e = handle dwc e >> return (All True)
|
||||||
|
|
||||||
handle :: Event -> X ()
|
handle :: DynamicWorkspaceConfig -> Event -> X ()
|
||||||
handle ClientMessageEvent {
|
handle dwc ClientMessageEvent {
|
||||||
ev_window = w,
|
ev_window = w,
|
||||||
ev_message_type = mt,
|
ev_message_type = mt,
|
||||||
ev_data = d
|
ev_data = d
|
||||||
|
@ -125,7 +127,9 @@ handle ClientMessageEvent {
|
||||||
if mt == a_cd then do
|
if mt == a_cd then do
|
||||||
let n = head d
|
let n = head d
|
||||||
if 0 <= n && fi n < length ws then
|
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 trace $ "Bad _NET_CURRENT_DESKTOP with data[0]="++show n
|
||||||
else if mt == a_d then do
|
else if mt == a_d then do
|
||||||
let n = head d
|
let n = head d
|
||||||
|
@ -133,7 +137,8 @@ handle ClientMessageEvent {
|
||||||
windows $ W.shiftWin (W.tag (ws !! fi n)) w
|
windows $ W.shiftWin (W.tag (ws !! fi n)) w
|
||||||
else trace $ "Bad _NET_DESKTOP with data[0]="++show n
|
else trace $ "Bad _NET_DESKTOP with data[0]="++show n
|
||||||
else if mt == a_aw then do
|
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
|
else if mt == a_cw then do
|
||||||
killWindow w
|
killWindow w
|
||||||
else if mt `elem` a_ignore then do
|
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
|
-- The Message is unknown to us, but that is ok, not all are meant
|
||||||
-- to be handled by the window manager
|
-- to be handled by the window manager
|
||||||
return ()
|
return ()
|
||||||
handle _ = return ()
|
handle _ _ = return ()
|
||||||
|
|
||||||
-- |
|
-- |
|
||||||
-- An event hook to handle applications that wish to fullscreen using the
|
-- An event hook to handle applications that wish to fullscreen using the
|
||||||
|
|
|
@ -28,7 +28,7 @@ import ProcessWorkspaces
|
||||||
|
|
||||||
modm = mod4Mask
|
modm = mod4Mask
|
||||||
|
|
||||||
main = xmonad $ ewmh $ defaultConfig
|
main = xmonad $ ewmh dwConfig $ defaultConfig
|
||||||
{ modMask = modm
|
{ modMask = modm
|
||||||
, manageHook = myManageHook
|
, manageHook = myManageHook
|
||||||
, layoutHook = desktopLayoutModifiers myLayoutHook
|
, layoutHook = desktopLayoutModifiers myLayoutHook
|
||||||
|
|
Reference in a new issue