diff --git a/xmonad/xmonad.hs b/xmonad/xmonad.hs index 60f64c6..63cab7f 100644 --- a/xmonad/xmonad.hs +++ b/xmonad/xmonad.hs @@ -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