From 17746c4d138f4029591ee488d3825b98552805b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Wed, 17 Dec 2025 11:49:57 +0800 Subject: [PATCH] vanadium/xmonad: warp when using vim movement bindings --- .../vanadium/home/xmonad/xmonad.hs | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/nix/configurations/vanadium/home/xmonad/xmonad.hs b/nix/configurations/vanadium/home/xmonad/xmonad.hs index e901bf6a..7acc4da2 100644 --- a/nix/configurations/vanadium/home/xmonad/xmonad.hs +++ b/nix/configurations/vanadium/home/xmonad/xmonad.hs @@ -260,6 +260,9 @@ removedKeybinds = ++ [ (superMask , 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 = [ @@ -305,33 +308,26 @@ keybinds = -- Switch between layers , ((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. -- This is especially useful because mag doesn't work well with focusFollowsMouse. -- The order is important: focus shift, and then warp the cursor -- -- 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) - , ((superMask .|. shiftMask, xK_Tab ), windows W.focusUp >> warp) - , ((superMask, xK_j ), windows W.focusDown >> warp) - , ((superMask, xK_k ), windows W.focusUp >> warp) - ] - ) - -- Screenshots + -- Directional navigation of windows + , ((altMask, xK_l), windowGo R False >> warpToWindowCenter) + , ((altMask, xK_h), windowGo L False >> warpToWindowCenter) + , ((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 ++ (let fullscreen = "maim -u | xclip -in -selection clipboard -t image/png" withSelection = "maim -u -s -b 5 -o | xclip -in -selection clipboard -t image/png" toFloat = "maim -u -s -b 5 -o | feh --auto-zoom -"