From d84c418e78ca9f24b9643e973794ef4fc016e6df Mon Sep 17 00:00:00 2001 From: mail Date: Mon, 31 Dec 2007 18:16:09 +0100 Subject: shiftPrevScreen and shiftNextScreen, to make CycleWS consistent darcs-hash:20071231171609-c9905-843656222b29cf2f40922b243d78be02608a9a8a.gz --- XMonad/Actions/CycleWS.hs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'XMonad/Actions/CycleWS.hs') diff --git a/XMonad/Actions/CycleWS.hs b/XMonad/Actions/CycleWS.hs index 1920d44..38a8d53 100644 --- a/XMonad/Actions/CycleWS.hs +++ b/XMonad/Actions/CycleWS.hs @@ -23,7 +23,9 @@ module XMonad.Actions.CycleWS ( shiftToPrev, toggleWS, nextScreen, - prevScreen + prevScreen, + shiftNextScreen, + shiftPrevScreen ) where import Data.List ( findIndex ) @@ -44,6 +46,8 @@ import XMonad.Util.WorkspaceCompare -- > , ((modMask x .|. shiftMask, xK_Up), shiftToPrev) -- > , ((modMask x, xK_Right), nextScreen) -- > , ((modMask x, xK_Left), prevScreen) +-- > , ((modMask x .|. shiftMask, xK_Right), shiftNextScreen) +-- > , ((modMask x .|. shiftMask, xK_Left), shiftPrevScreen) -- > , ((modMask x, xK_t), toggleWS) -- -- If you want to follow the moved window, you can use both actions: @@ -113,3 +117,18 @@ screenBy d = do ws <- gets windowset --let ss = sortBy screen (screens ws) let now = screen (current ws) return $ (now + fromIntegral d) `mod` fromIntegral (length (screens ws)) + +-- | Move focused window to workspace on next screen +shiftNextScreen :: X () +shiftNextScreen = shiftScreenBy 1 + +-- | Move focused window to workspace on prev screen +shiftPrevScreen :: X () +shiftPrevScreen = shiftScreenBy (-1) + +shiftScreenBy :: Int -> X () +shiftScreenBy d = do s <- screenBy d + mws <- screenWorkspace s + case mws of + Nothing -> return () + Just ws -> windows (shift ws) -- cgit v1.2.3