[XMonad] Add emacs style buffer (window) switching

This commit is contained in:
Ivan Malison 2016-11-11 15:48:47 -08:00
parent 27e8b16a7b
commit a5e5ad867c
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -216,8 +216,10 @@ toggleFadingForActiveWindow = withWindowSet $ \windowSet -> do
restoreFocus action = withFocused $ \orig -> action >> windows (W.focusWindow orig) restoreFocus action = withFocused $ \orig -> action >> windows (W.focusWindow orig)
getCurrentWS = W.stack . W.workspace . W.current
withWorkspace f = withWindowSet $ \ws -> withWorkspace f = withWindowSet $ \ws ->
maybe (return ()) f (W.stack . W.workspace . W.current $ ws) maybe (return ()) f (getCurrentWS ws)
minimizeOtherClassesInWorkspace = minimizeOtherClassesInWorkspace =
actOnWindowsInWorkspace minimizeWindow windowsWithUnfocusedClass actOnWindowsInWorkspace minimizeWindow windowsWithUnfocusedClass
@ -273,6 +275,16 @@ greedyFocusWindow w ws = W.focusWindow w $ W.greedyView
shiftThenView i = W.greedyView i . W.shift i shiftThenView i = W.greedyView i . W.shift i
shiftToEmptyAndView = doTo Next EmptyWS DWO.getSortByOrder (windows . shiftThenView) shiftToEmptyAndView = doTo Next EmptyWS DWO.getSortByOrder (windows . shiftThenView)
swapFocusedWith w ws = W.modify' (swapFocusedWith' w) (W.delete' w ws)
swapFocusedWith' w (W.Stack current ls rs) = W.Stack w ls (rs ++ [current])
swapMinimizeStateAfter action = withFocused $ \originalWindow -> do
_ <- action
restoreFocus $ do
maybeUnminimizeFocused
minimizeWindow originalWindow
-- Raise or spawn -- Raise or spawn
@ -296,6 +308,8 @@ addKeys conf@XConfig {modMask = modm} =
actionMenu myWindowBringerConfig greedyFocusWindow) actionMenu myWindowBringerConfig greedyFocusWindow)
, ((modm, xK_b), maybeUnminimizeAfter $ , ((modm, xK_b), maybeUnminimizeAfter $
bringMenuConfig myWindowBringerConfig) bringMenuConfig myWindowBringerConfig)
, ((modm .|. shiftMask, xK_b), swapMinimizeStateAfter $
actionMenu myWindowBringerConfig swapFocusedWith)
, ((modm .|. controlMask, xK_t), spawn , ((modm .|. controlMask, xK_t), spawn
"systemctl --user restart taffybar.service") "systemctl --user restart taffybar.service")
, ((modm, xK_v), spawn "copyq paste") , ((modm, xK_v), spawn "copyq paste")