From 088c6b31a5a5cee7b402b101bb88720ff853c652 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Wed, 7 Jan 2026 14:03:04 +0100 Subject: [PATCH] vanadium/xmonad: remove floating window from the count --- nix/configurations/vanadium/home/xmonad/xmonad.hs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/nix/configurations/vanadium/home/xmonad/xmonad.hs b/nix/configurations/vanadium/home/xmonad/xmonad.hs index 3a57cc1e..48e9dabf 100644 --- a/nix/configurations/vanadium/home/xmonad/xmonad.hs +++ b/nix/configurations/vanadium/home/xmonad/xmonad.hs @@ -33,9 +33,9 @@ import XMonad.Util.NamedScratchpad import XMonad.Util.SpawnOnce import Data.Char.Greek +import qualified Data.Map.Strict as M import Data.Ratio import Data.Semigroup -import qualified Data.Map.Strict as M import System.Posix import Graphics.X11.ExtraTypes.XF86 @@ -209,7 +209,17 @@ setMasterNEventHandleHook :: Event -> X All setMasterNEventHandleHook ev = let adjustMasterCount :: X () adjustMasterCount = do - count <- gets $ length . W.integrate' . W.stack . W.workspace . W.current . windowset + ws <- gets windowset + -- Remove the floating windows in the count + let s :: Maybe (W.Stack Window) + s = W.stack $ W.workspace $ W.current ws + + count :: Int + count = + length + $ filter (flip M.notMember (W.floating ws)) + $ W.integrate' s + if count >= 7 then sendMessage (SetMasterN 4) else if count >= 5 then sendMessage (SetMasterN 3) else if count >= 3 then sendMessage (SetMasterN 2)