From 7fcb150943032880abd5a0be6421a68b9cf234a5 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Sat, 9 Dec 2023 00:40:01 -0700 Subject: Added BorderColors.hs This module manager border colors for the windows and handles automatically maintaining the colors across stack changes. This also adds green borders to pinned windows to differentiate them from normal windows. --- src/Rahm/Desktop/Layout/PinWindow.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/Rahm/Desktop/Layout/PinWindow.hs') diff --git a/src/Rahm/Desktop/Layout/PinWindow.hs b/src/Rahm/Desktop/Layout/PinWindow.hs index f993eec..6ccf35a 100644 --- a/src/Rahm/Desktop/Layout/PinWindow.hs +++ b/src/Rahm/Desktop/Layout/PinWindow.hs @@ -22,6 +22,7 @@ import qualified Rahm.Desktop.StackSet as W import XMonad import qualified XMonad.StackSet as W (filter) import qualified XMonad.Util.ExtensibleState as XS +import Rahm.Desktop.BorderColors (setBorderColor, BorderColor (BorderColor), resetBorderColor) newtype PinWindowState = PinWindowState (Map ScreenId [(Window, W.RationalRect)]) deriving (Show, Read) @@ -36,6 +37,8 @@ instance ExtensionClass PinWindowState where newtype PinWindowLayout (l :: * -> *) (a :: *) = PinWindowLayout (l a) deriving (Show, Read) +pinnedWindowColor = BorderColor "#00ff00" "#408040" + instance (LayoutClass l a, sid ~ ScreenId, a ~ Window) => LayoutClass (PinWindowLayout l) a where runLayout (W.Workspace t (PinWindowLayout l) stack) rect = do -- Clean up window id's thare should not be pinned anymore because the @@ -100,6 +103,7 @@ pinWindow win = runMaybeT_ $ do -- Don't float the window anymore. modifyWindowSet $ W.sink win + setBorderColor pinnedWindowColor [win] where hoist = MaybeT . return @@ -115,6 +119,7 @@ unpinWindow win = runMaybeT_ $ do -- refloat the window. modifyWindowSet $ W.float win rect + resetBorderColor [win] where hoist = MaybeT . return -- cgit