xmonad: fixed borring windows/workspace switching

This commit is contained in:
Ingolf Wagner 2019-11-07 16:24:47 +01:00
parent 99fd873cb8
commit 771705fe6b
Signed by: palo
GPG key ID: 76BF5F1928B9618B

View file

@ -160,13 +160,17 @@ myKeys XConfig {modMask = modm} =
-- --
-- mod-[1..9], Switch to workspace N -- mod-[1..9], Switch to workspace N
[ ( (m .|. modm, k) [ ( (m .|. modm, k)
, removeEmptyWorkspaceAfterExcept nonRemovableWorkspaces $ windows $ f i) , do removeEmptyWorkspaceAfterExcept nonRemovableWorkspaces $ windows $ f i
updateBoring
)
| (i, k) <- zip myWorkspaces [xK_1 .. xK_9] | (i, k) <- zip myWorkspaces [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0)] , (f, m) <- [(W.greedyView, 0)]
] ++ ] ++
-- mod-<shift>-[1..9] move window to workspace N -- mod-<shift>-[1..9] move window to workspace N
-- mod-<control>-[1..9] copy window to workspace N -- mod-<control>-[1..9] copy window to workspace N
[ ((m .|. modm, k), windows $ f i) [ ((m .|. modm, k),
do windows $ f i
updateBoring)
| (i, k) <- zip myWorkspaces [xK_1 .. xK_9] | (i, k) <- zip myWorkspaces [xK_1 .. xK_9]
, (f, m) <- [(W.shift, shiftMask), (copy, controlMask)] , (f, m) <- [(W.shift, shiftMask), (copy, controlMask)]
] ]
@ -220,8 +224,10 @@ myAdditionaKeys
= =
(multiKeys (multiKeys
[ ( "`" [ ( "`"
, removeEmptyWorkspaceAfterExcept nonRemovableWorkspaces $ , do
withWorkspace autoXPConfig (windows . W.greedyView)) removeEmptyWorkspaceAfterExcept nonRemovableWorkspaces
( withWorkspace autoXPConfig (windows . W.greedyView ))
updateBoring)
-- move focused window to workspace -- move focused window to workspace
, ("S-<Space>", withWorkspace myXPConfig (windows . W.shift)) , ("S-<Space>", withWorkspace myXPConfig (windows . W.shift))
-- copy focused window to workspace -- copy focused window to workspace
@ -239,7 +245,9 @@ myAdditionaKeys
, ( "r" , ( "r"
, do renameWorkspace myXPConfig , do renameWorkspace myXPConfig
sequence_ [addHiddenWorkspace ws | ws <- myWorkspaces]) sequence_ [addHiddenWorkspace ws | ws <- myWorkspaces])
, ("<Esc>", toggleWS' ["NSP"]) , ("<Esc>", do toggleWS' ["NSP"]
updateBoring
)
]) ++ ]) ++
-- ------------------------------------------------------------ -- ------------------------------------------------------------
-- --
@ -251,7 +259,8 @@ myAdditionaKeys
[ ("<Return>", spawn $ XMonad.terminal defaults) [ ("<Return>", spawn $ XMonad.terminal defaults)
, ("q", kill1) , ("q", kill1)
-- open scratchpad -- open scratchpad
, ("-", scratchpadSpawnAction defaults) , ("-", do scratchpadSpawnAction defaults
updateBoring)
]) ++ ]) ++
[ ( "<Print>" [ ( "<Print>"
-- create screenshot -- create screenshot
@ -483,6 +492,12 @@ main = do
myTerm :: FilePath myTerm :: FilePath
myTerm = nixStartTerminal myTerm = nixStartTerminal
-- make sure we never select a boring window
-- when we select another workspace.
updateBoring = do focusUp
focusDown
-- A structure containing your configuration settings, overriding -- A structure containing your configuration settings, overriding
-- fields in the default config. Any you don't override, will -- fields in the default config. Any you don't override, will
-- use the defaults defined in xmonad/XMonad/Config.hs -- use the defaults defined in xmonad/XMonad/Config.hs
@ -512,12 +527,20 @@ defaults =
-- key bindings -- key bindings
, keys = myKeys , keys = myKeys
, mouseBindings = mouse , mouseBindings = mouse
-- hooks, layouts
, layoutHook = focusTracking $ historyLayout myLayout -- todo: historyLayout does not work with boring windows yet
, layoutHook = focusTracking $ myLayout
-- , layoutHook = focusTracking $ historyLayout myLayout
-- todo : runAllPending does not work with boring windows yet
, logHook = myLogHook
-- , logHook = myLogHook <> runAllPending
, startupHook = startUp
, manageHook = myManageHook , manageHook = myManageHook
, handleEventHook = myEventHook , handleEventHook = myEventHook
, logHook = myLogHook <> runAllPending
, startupHook = startUp
} `additionalKeysP` } `additionalKeysP`
myAdditionaKeys myAdditionaKeys