vanadium/xmonad: warp when using vim movement bindings

This commit is contained in:
Primrose 2025-12-17 11:49:57 +08:00
parent 1ee7160610
commit 17746c4d13
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -260,6 +260,9 @@ removedKeybinds =
++ [ (superMask , n) | n <- [xK_1 .. xK_9] ] ++ [ (superMask , n) | n <- [xK_1 .. xK_9] ]
++ [ (superMask .|. shiftMask, n) | n <- [xK_1 .. xK_9] ] ++ [ (superMask .|. shiftMask, n) | n <- [xK_1 .. xK_9] ]
warpToWindowCenter :: X ()
warpToWindowCenter = warpToWindow 0.5 0.5
keybinds :: [((KeyMask, KeySym), X ())] keybinds :: [((KeyMask, KeySym), X ())]
keybinds = keybinds =
[ [
@ -305,31 +308,24 @@ keybinds =
-- Switch between layers -- Switch between layers
, ((altMask, xK_s), switchLayer ) , ((altMask, xK_s), switchLayer )
-- Directional navigation of windows
, ((altMask, xK_l), windowGo R False )
, ((altMask, xK_h), windowGo L False )
, ((altMask, xK_k), windowGo U False )
, ((altMask, xK_j), windowGo D False )
-- Swap adjacent windows
, ((altMask .|. superMask, xK_l), windowSwap R False)
, ((altMask .|. superMask, xK_h), windowSwap L False)
, ((altMask .|. superMask, xK_k), windowSwap U False)
, ((altMask .|. superMask, xK_j), windowSwap D False)
]
-- We override default focus shifting bindings to warp the cursor to the center of the new window. -- We override default focus shifting bindings to warp the cursor to the center of the new window.
-- This is especially useful because mag doesn't work well with focusFollowsMouse. -- This is especially useful because mag doesn't work well with focusFollowsMouse.
-- The order is important: focus shift, and then warp the cursor -- The order is important: focus shift, and then warp the cursor
-- --
-- Warp when focus shifts by binding, not by mouse (otherwise it's annoying) -- Warp when focus shifts by binding, not by mouse (otherwise it's annoying)
++ (let warp = warpToWindow 0.5 0.5
in [ ((superMask, xK_Tab ), windows W.focusDown >> warp) -- Directional navigation of windows
, ((superMask .|. shiftMask, xK_Tab ), windows W.focusUp >> warp) , ((altMask, xK_l), windowGo R False >> warpToWindowCenter)
, ((superMask, xK_j ), windows W.focusDown >> warp) , ((altMask, xK_h), windowGo L False >> warpToWindowCenter)
, ((superMask, xK_k ), windows W.focusUp >> warp) , ((altMask, xK_k), windowGo U False >> warpToWindowCenter)
, ((altMask, xK_j), windowGo D False >> warpToWindowCenter)
-- Swap adjacent windows
, ((altMask .|. superMask, xK_l), windowSwap R False >> warpToWindowCenter)
, ((altMask .|. superMask, xK_h), windowSwap L False >> warpToWindowCenter)
, ((altMask .|. superMask, xK_k), windowSwap U False >> warpToWindowCenter)
, ((altMask .|. superMask, xK_j), windowSwap D False >> warpToWindowCenter)
] ]
)
-- Screenshots -- Screenshots
++ (let fullscreen = "maim -u | xclip -in -selection clipboard -t image/png" ++ (let fullscreen = "maim -u | xclip -in -selection clipboard -t image/png"