vanadium/xmonad: remove floating window from the count

This commit is contained in:
Primrose 2026-01-07 14:03:04 +01:00
parent 040afef280
commit 088c6b31a5
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -33,9 +33,9 @@ import XMonad.Util.NamedScratchpad
import XMonad.Util.SpawnOnce import XMonad.Util.SpawnOnce
import Data.Char.Greek import Data.Char.Greek
import qualified Data.Map.Strict as M
import Data.Ratio import Data.Ratio
import Data.Semigroup import Data.Semigroup
import qualified Data.Map.Strict as M
import System.Posix import System.Posix
import Graphics.X11.ExtraTypes.XF86 import Graphics.X11.ExtraTypes.XF86
@ -209,7 +209,17 @@ setMasterNEventHandleHook :: Event -> X All
setMasterNEventHandleHook ev = setMasterNEventHandleHook ev =
let adjustMasterCount :: X () let adjustMasterCount :: X ()
adjustMasterCount = do 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) if count >= 7 then sendMessage (SetMasterN 4)
else if count >= 5 then sendMessage (SetMasterN 3) else if count >= 5 then sendMessage (SetMasterN 3)
else if count >= 3 then sendMessage (SetMasterN 2) else if count >= 3 then sendMessage (SetMasterN 2)