swap windows like a boss

main
千住柱間 2024-03-16 17:39:02 +00:00
parent f0a9c1e63c
commit 764e8190fd
1 changed files with 19 additions and 2 deletions

View File

@ -39,6 +39,14 @@ import XMonad.Layout.PerScreen (ifWider)
import XMonad.StackSet
import XMonad.Layout
import XMonad.Layout.Reflect
import XMonad.Layout.WindowArranger
-- Window Rearragement
import Data.List (find)
import XMonad.Actions.EasyMotion (selectWindow)
import XMonad.Actions.FocusNth (swapNth)
import qualified XMonad.StackSet as W
main :: IO ()
@ -51,7 +59,7 @@ main = xmonad
myConfig = def
{ modMask = mod4Mask -- Rebind Mod to the Super key
, layoutHook = myLayout -- Use custom layouts
, layoutHook = windowArrange myLayout -- Use custom layouts
, terminal = "alacritty"
, focusedBorderColor = "#000000"
, manageHook = myManageHook -- Match on certain windows
@ -83,9 +91,18 @@ myConfig = def
, ("M-f", viewEmptyWorkspace) -- View an empty workspace
, ("M-S-w", spawn "flameshot gui --path=/mnt/Data/mpv-screenshots/screenshots")
, ("M-w", spawn "~/.local/bin/copy_image.sh")
, ("M-v", toggleLayout)
, ("M-v", easySwap)
]
easySwap :: X ()
easySwap = do
win <- selectWindow def
stack <- gets $ W.index . windowset
let match = find ((win ==) . Just . fst) $ zip stack [0 ..]
whenJust match $ swapNth . snd
myManageHook :: ManageHook
myManageHook = composeAll