From 073078a9223d70ad50fbac853ec5048a5b8be6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Tue, 4 Nov 2025 10:50:29 +0800 Subject: [PATCH] vanadium/xmonad: show nmaster count in description --- .../vanadium/home/xmonad/leanamonad.cabal | 3 ++- .../{Layouts => Layout}/ReflectMsg.hs | 2 +- .../lib/Leanamonad/Layout/ResizableTile.hs | 27 +++++++++++++++++++ .../vanadium/home/xmonad/xmonad.hs | 7 +++-- 4 files changed, 35 insertions(+), 4 deletions(-) rename nix/configurations/vanadium/home/xmonad/lib/Leanamonad/{Layouts => Layout}/ReflectMsg.hs (94%) create mode 100644 nix/configurations/vanadium/home/xmonad/lib/Leanamonad/Layout/ResizableTile.hs diff --git a/nix/configurations/vanadium/home/xmonad/leanamonad.cabal b/nix/configurations/vanadium/home/xmonad/leanamonad.cabal index de874f27..c1978c6c 100644 --- a/nix/configurations/vanadium/home/xmonad/leanamonad.cabal +++ b/nix/configurations/vanadium/home/xmonad/leanamonad.cabal @@ -24,7 +24,8 @@ library import: common hs-source-dirs: lib exposed-modules: - Leanamonad.Layouts.ReflectMsg + Leanamonad.Layout.ReflectMsg + Leanamonad.Layout.ResizableTile Leanamonad.GreekChar executable leanamonad diff --git a/nix/configurations/vanadium/home/xmonad/lib/Leanamonad/Layouts/ReflectMsg.hs b/nix/configurations/vanadium/home/xmonad/lib/Leanamonad/Layout/ReflectMsg.hs similarity index 94% rename from nix/configurations/vanadium/home/xmonad/lib/Leanamonad/Layouts/ReflectMsg.hs rename to nix/configurations/vanadium/home/xmonad/lib/Leanamonad/Layout/ReflectMsg.hs index f86e4632..8b69af56 100644 --- a/nix/configurations/vanadium/home/xmonad/lib/Leanamonad/Layouts/ReflectMsg.hs +++ b/nix/configurations/vanadium/home/xmonad/lib/Leanamonad/Layout/ReflectMsg.hs @@ -1,7 +1,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} -module Leanamonad.Layouts.ReflectMsg where +module Leanamonad.Layout.ReflectMsg where import XMonad ( Resize (Expand, Shrink), diff --git a/nix/configurations/vanadium/home/xmonad/lib/Leanamonad/Layout/ResizableTile.hs b/nix/configurations/vanadium/home/xmonad/lib/Leanamonad/Layout/ResizableTile.hs new file mode 100644 index 00000000..7692147d --- /dev/null +++ b/nix/configurations/vanadium/home/xmonad/lib/Leanamonad/Layout/ResizableTile.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} + +module Leanamonad.Layout.ResizableTile + ( module XMonad.Layout.ResizableTile + , RTFixDescription(..) + ) where + +import XMonad +import qualified XMonad.StackSet as W +import XMonad.Layout.ResizableTile + +newtype RTFixDescription a = RTFixDescription { unwrapRT :: ResizableTall a } + deriving (Read, Show) + +instance LayoutClass RTFixDescription a where + runLayout (W.Workspace t l s) = + let ws' = W.Workspace t (unwrapRT l) s + in fmap (fmap (fmap RTFixDescription)) + . runLayout ws' + + handleMessage (RTFixDescription l) m = + fmap (fmap RTFixDescription) + $ handleMessage l m + + description (RTFixDescription l) = + description l <> " " <> show (_nmaster l) diff --git a/nix/configurations/vanadium/home/xmonad/xmonad.hs b/nix/configurations/vanadium/home/xmonad/xmonad.hs index 301d0afc..d7921849 100644 --- a/nix/configurations/vanadium/home/xmonad/xmonad.hs +++ b/nix/configurations/vanadium/home/xmonad/xmonad.hs @@ -26,7 +26,9 @@ import qualified Data.Map.Strict as M import System.Posix import Graphics.X11.ExtraTypes.XF86 -import Leanamonad.Layouts.ReflectMsg +import Leanamonad.Layout.ReflectMsg +-- TODO: rename this module +import Leanamonad.Layout.ResizableTile import Leanamonad.GreekChar main :: IO () @@ -65,9 +67,10 @@ main = putEnv "MOZ_USE_XINPUT2=1" -- Force touchpad for firefox , layoutHook = - let tallr = named "Normal" + let tallr = renamed [ KeepWordsRight 2 ] {- keep "ResizableTall n" -} $ smartSpacingWithEdge 5 $ reflectMsg . reflectHoriz + $ RTFixDescription $ ResizableTall 1 (1/10) (3/7) [] mag = magnifyxy 1.05 1.3 (NoMaster 3) False in avoidStruts . smartBorders $