From 8aecd18722cf58fb8d621618f60cd49cc154253e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Thu, 11 Dec 2025 22:04:10 +0800 Subject: [PATCH] vanadium/xmonad: warp to window --- nix/configurations/vanadium/home/xmonad/xmonad.hs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nix/configurations/vanadium/home/xmonad/xmonad.hs b/nix/configurations/vanadium/home/xmonad/xmonad.hs index f8779346..415a0fc1 100644 --- a/nix/configurations/vanadium/home/xmonad/xmonad.hs +++ b/nix/configurations/vanadium/home/xmonad/xmonad.hs @@ -5,6 +5,7 @@ import XMonad import XMonad.Actions.CopyWindow import XMonad.Actions.Submap import XMonad.Actions.SwapWorkspaces +import XMonad.Actions.Warp import XMonad.Hooks.DynamicLog import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.InsertPosition @@ -300,6 +301,19 @@ keybinds = ) ] + -- 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 ++ (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"