refactor: simplify navigation keybinds

Replace Navigation2D directional navigation with simpler window cycling.
Arrow keys now cycle windows/workspaces, shifted arrows for rotation/screens.
This commit is contained in:
♥ Minnie ♥ 2025-10-03 09:54:37 +08:00
parent 67dd85a933
commit 9ce0ee6dcc
Signed by: jasmine
GPG key ID: 8563E358D4E8040E

View file

@ -1,7 +1,7 @@
import Data.List as L import Data.List as L
import XMonad import XMonad
import XMonad.Actions.CycleWS import XMonad.Actions.CycleWS
import XMonad.Actions.Navigation2D import XMonad.Actions.CycleWindows
import XMonad.Actions.RotSlaves import XMonad.Actions.RotSlaves
import XMonad.Hooks.DynamicLog import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.EwmhDesktops
@ -29,7 +29,6 @@ main = xmonad
. docks . docks
. ewmhFullscreen . ewmhFullscreen
. ewmh . ewmh
. withNavigation2DConfig def
. withSB myXmobar . withSB myXmobar
$ myConfig $ myConfig
@ -85,30 +84,24 @@ myKeymap =
-- --
-- Layout Navigation -- Navigation
-- --
-- directional navigation of windows
, ("M-<Up>" , windowGo U False)
, ("M-<Left>" , windowGo L False)
, ("M-<Down>" , windowGo D False)
, ("M-<Right>" , windowGo R False)
-- cycle windows -- cycle windows
, ("M-<Page_Up>" , windows W.focusUp ) , ("M-<Up>" , windows W.focusUp )
, ("M-<Page_Down>", windows W.focusDown) , ("M-<Down>", windows W.focusDown)
-- window rotation
, ("M-C-<Page_Up>", rotAllUp)
, ("M-C-<Page_Down>", rotAllDown)
-- cycle workspaces -- cycle workspaces
, ("M-<Home>", moveTo Prev hiddenWS) , ("M-<Left>" , moveTo Prev hiddenWS)
, ("M-<End>" , moveTo Next hiddenWS) , ("M-<Right>", moveTo Next hiddenWS)
-- focus screens (directional) -- window rotation
, ("M-C-<Home>", screenGo L False) -- focus left monitor , ("M-S-<Up>", rotAllUp)
, ("M-C-<End>", screenGo R False) -- focus right monitor , ("M-S-<Down>", rotAllDown)
-- focus screens
, ("M-S-<Left>", prevScreen)
, ("M-S-<Right>", nextScreen)
-- switch workspaces -- switch workspaces
, ("M-1", windows $ W.greedyView "code" ) , ("M-1", windows $ W.greedyView "code" )
@ -125,10 +118,10 @@ myKeymap =
, ("M-S-5", windows $ W.shift "misc" ) , ("M-S-5", windows $ W.shift "misc" )
-- master pane manipulation -- master pane manipulation
, ("M-C-<Left>", sendMessage Shrink) -- control layout: shrink master , ("M-<Home>", sendMessage Shrink) -- shrink master pane width
, ("M-C-<Right>", sendMessage Expand) -- control layout: expand master , ("M-<End>", sendMessage Expand) -- expand master pane width
, ("M-S-<Left>", sendMessage (IncMasterN 1)) -- shift windows: more in master , ("M-<Page_Up>", sendMessage (IncMasterN 1)) -- more windows in master
, ("M-S-<Right>", sendMessage (IncMasterN (-1))) -- shift windows: fewer in master , ("M-<Page_Down>", sendMessage (IncMasterN (-1))) -- fewer windows in master
-- master window operations -- master window operations
, ("M-<Delete>", windows W.focusMaster) , ("M-<Delete>", windows W.focusMaster)