[XMonad] Add shiftToEmptyNextScreen

This commit is contained in:
Ivan Malison 2016-11-29 11:28:17 -08:00
parent 98b4024ac1
commit 224cb93b17
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -18,7 +18,7 @@ import System.Taffybar.Hooks.PagerHints
import Text.Printf import Text.Printf
import XMonad hiding ( (|||) ) import XMonad hiding ( (|||) )
import XMonad.Actions.CycleWS import XMonad.Actions.CycleWS hiding (nextScreen)
import qualified XMonad.Actions.DynamicWorkspaceOrder as DWO import qualified XMonad.Actions.DynamicWorkspaceOrder as DWO
import XMonad.Actions.Minimize import XMonad.Actions.Minimize
import XMonad.Actions.WindowBringer import XMonad.Actions.WindowBringer
@ -439,6 +439,34 @@ greedyBringWindow w = greedyFocusWindow w . bringWindow w
shiftToEmptyAndView = shiftToEmptyAndView =
doTo Next EmptyWS DWO.getSortByOrder (windows . shiftThenView) doTo Next EmptyWS DWO.getSortByOrder (windows . shiftThenView)
setFocusedScreen :: ScreenId -> WindowSet -> WindowSet
setFocusedScreen to ws =
maybe ws (flip setFocusedScreen' ws) $ find ((to ==) . W.screen) (W.visible ws)
setFocusedScreen' to ws @ W.StackSet
{ W.current = prevCurr
, W.visible = visible
} = ws { W.current = to
, W.visible = prevCurr:(deleteBy screenEq to visible)
}
where screenEq a b = W.screen a == W.screen b
nextScreen ws @ W.StackSet { W.visible = visible } =
case visible of
next:_ -> setFocusedScreen (W.screen next) ws
_ -> ws
viewOtherScreen ws = W.greedyView ws . nextScreen
shiftThenViewOtherScreen ws w = (viewOtherScreen ws) . (W.shiftWin ws w)
shiftCurrentToWSOnOtherScreen ws s =
fromMaybe s (flip (shiftThenViewOtherScreen ws) s <$> W.peek s)
shiftToEmptyNextScreen =
doTo Next EmptyWS DWO.getSortByOrder $ windows . shiftCurrentToWSOnOtherScreen
swapFocusedWith w ws = W.modify' (swapFocusedWith' w) (W.delete' w ws) swapFocusedWith w ws = W.modify' (swapFocusedWith' w) (W.delete' w ws)
swapFocusedWith' w (W.Stack current ls rs) = W.Stack w ls (rs ++ [current]) swapFocusedWith' w (W.Stack current ls rs) = W.Stack w ls (rs ++ [current])
@ -512,6 +540,7 @@ addKeys conf@XConfig {modMask = modm} =
, ((modm, xK_backslash), toggleWS) , ((modm, xK_backslash), toggleWS)
, ((modm, xK_space), deactivateFullOr $ sendMessage NextLayout) , ((modm, xK_space), deactivateFullOr $ sendMessage NextLayout)
, ((modm, xK_z), shiftToNextScreen) , ((modm, xK_z), shiftToNextScreen)
, ((modm .|. shiftMask, xK_z), shiftToEmptyNextScreen)
, ((modm, xK_x), windows $ W.shift "NSP") , ((modm, xK_x), windows $ W.shift "NSP")
, ((modm .|. shiftMask, xK_h), shiftToEmptyAndView) , ((modm .|. shiftMask, xK_h), shiftToEmptyAndView)
-- These need to be rebound to support boringWindows -- These need to be rebound to support boringWindows