From 9e5d56cfb2508d9f5e58bf681265d0f1070b3f35 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Fri, 15 Apr 2022 23:55:35 -0600 Subject: Make history much, much more reliable. This time history is being done using a hook to keep track of history. This means I don't have to manually call pushHistory every time I focus a new window. --- src/Main.hs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index 56c66f5..edce3fb 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -11,6 +11,7 @@ import XMonad.Layout.Fullscreen (fullscreenEventHook) import System.Environment (setEnv) import Data.Monoid import qualified Data.Map as Map +import Text.Printf import Rahm.Desktop.Swallow import Rahm.Desktop.Windows @@ -20,6 +21,8 @@ import Rahm.Desktop.Layout import Rahm.Desktop.Logger import Rahm.Desktop.DMenu (menuCommandString) import Rahm.Desktop.RebindKeys +import Rahm.Desktop.Hooks.WindowChange +import Rahm.Desktop.History import qualified XMonad as X import qualified XMonad.StackSet as W @@ -35,8 +38,8 @@ main = do xmobar <- spawnXMobar - (=<<) X.xmonad $ - applyKeys $ ewmh $ docks $ def + (=<<) X.xmonad $ + applyKeys $ withLocationChangeHook historyHook $ ewmh $ docks $ def { terminal = "alacritty" , modMask = mod3Mask , borderWidth = 2 @@ -75,6 +78,10 @@ main = do } +changeHook :: Location -> Location -> X () +changeHook l1 l2 = do + logs $ printf "Change %s -> %s" (show l1) (show l2) + doCenterFloat :: ManageHook doCenterFloat = ask >>= \w -> doF . W.float w . centerRect . snd =<< liftX (floatLocation w) -- cgit