vanadium/xmonad: warp to window

This commit is contained in:
Primrose 2025-12-11 22:04:10 +08:00
parent 214eaa957c
commit 8aecd18722
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -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"