From 040afef28048cc98f3a81cf8baaa0a928a2a6653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Wed, 7 Jan 2026 13:32:48 +0100 Subject: [PATCH 1/4] vanadium/xmonad: return Nothing if the layout is not changed --- .../home/xmonad/lib/XMonad/Layout/SetMasterNTall.hs | 6 ++++-- nix/configurations/vanadium/home/xmonad/xmonad.hs | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/nix/configurations/vanadium/home/xmonad/lib/XMonad/Layout/SetMasterNTall.hs b/nix/configurations/vanadium/home/xmonad/lib/XMonad/Layout/SetMasterNTall.hs index a08f7742..a09af1d3 100644 --- a/nix/configurations/vanadium/home/xmonad/lib/XMonad/Layout/SetMasterNTall.hs +++ b/nix/configurations/vanadium/home/xmonad/lib/XMonad/Layout/SetMasterNTall.hs @@ -23,8 +23,10 @@ instance LayoutClass SetMasterNTall a where let ws' = W.Workspace t (unSetMasterNTall l) s in (fmap . fmap . fmap) SetMasterNTall . runLayout ws' - handleMessage (SetMasterNTall l@(ResizableTall _n0 d f s)) mess - | Just (SetMasterN n) <- fromMessage mess = pure $ Just $ SetMasterNTall $ ResizableTall n d f s + handleMessage (SetMasterNTall l@(ResizableTall n0 d f s)) mess + | Just (SetMasterN n) <- fromMessage mess = pure $ + if n0 /= n then Just $ SetMasterNTall $ ResizableTall n d f s + else Nothing | otherwise = (fmap . fmap) SetMasterNTall . handleMessage l $ mess description (SetMasterNTall l) = description l diff --git a/nix/configurations/vanadium/home/xmonad/xmonad.hs b/nix/configurations/vanadium/home/xmonad/xmonad.hs index e5c8ad57..3a57cc1e 100644 --- a/nix/configurations/vanadium/home/xmonad/xmonad.hs +++ b/nix/configurations/vanadium/home/xmonad/xmonad.hs @@ -210,10 +210,10 @@ setMasterNEventHandleHook ev = let adjustMasterCount :: X () adjustMasterCount = do count <- gets $ length . W.integrate' . W.stack . W.workspace . W.current . windowset - if count <= 3 then sendMessage (SetMasterN 1) - else if count <= 5 then sendMessage (SetMasterN 2) - else if count <= 7 then sendMessage (SetMasterN 3) - else pure () + if count >= 7 then sendMessage (SetMasterN 4) + else if count >= 5 then sendMessage (SetMasterN 3) + else if count >= 3 then sendMessage (SetMasterN 2) + else sendMessage (SetMasterN 1) in do case ev of MapRequestEvent{} -> adjustMasterCount 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 2/4] 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) From 245da500a0bd67118286d133ff6d4a1869b60f33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Wed, 7 Jan 2026 14:52:49 +0100 Subject: [PATCH 3/4] vanadium: enable printer --- .../vanadium/nixos/connectivity.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/nix/configurations/vanadium/nixos/connectivity.nix b/nix/configurations/vanadium/nixos/connectivity.nix index 024f0b25..17ca3b84 100644 --- a/nix/configurations/vanadium/nixos/connectivity.nix +++ b/nix/configurations/vanadium/nixos/connectivity.nix @@ -76,4 +76,20 @@ services.mullvad-vpn.enable = true; hardware.bluetooth.enable = true; + + + # Printing and auto-discovery of Wi-Fi printers + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + + services.printing = { + enable = true; + drivers = with pkgs; [ + cups-filters + cups-browsed + ]; + }; } From 2d17c2c145fcc1a9ffd011c5e3292147de167a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Wed, 7 Jan 2026 16:03:57 +0100 Subject: [PATCH 4/4] vanadium/xmonad: fix off by one if condition --- nix/configurations/vanadium/home/xmonad/xmonad.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nix/configurations/vanadium/home/xmonad/xmonad.hs b/nix/configurations/vanadium/home/xmonad/xmonad.hs index 48e9dabf..f9cbd2bc 100644 --- a/nix/configurations/vanadium/home/xmonad/xmonad.hs +++ b/nix/configurations/vanadium/home/xmonad/xmonad.hs @@ -220,9 +220,9 @@ setMasterNEventHandleHook ev = $ 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) + if count > 7 then sendMessage (SetMasterN 4) + else if count > 5 then sendMessage (SetMasterN 3) + else if count > 3 then sendMessage (SetMasterN 2) else sendMessage (SetMasterN 1) in do case ev of