xmonad: refactor config

This commit is contained in:
Primrose 2025-02-28 19:32:34 +01:00
parent 7d8468427c
commit daa656b99e
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
5 changed files with 231 additions and 197 deletions

View file

@ -0,0 +1,26 @@
module XMonad.Leana.Layouts.ReflectMsg where
import XMonad (
Resize (Expand, Shrink),
SomeMessage (SomeMessage),
fromMessage,
)
import XMonad.Layout.LayoutModifier (
LayoutModifier (handleMess, handleMessOrMaybeModifyIt),
ModifiedLayout (ModifiedLayout),
)
data ReflectMsg a = ReflectMsg deriving (Show, Read)
reflectMsg :: l a -> ModifiedLayout ReflectMsg l a
reflectMsg = ModifiedLayout ReflectMsg
instance LayoutModifier ReflectMsg a where
handleMessOrMaybeModifyIt m mess
| Just Shrink <- fromMessage mess = return . Just . Right $ SomeMessage Expand
| Just Expand <- fromMessage mess = return . Just . Right $ SomeMessage Shrink
-- Handle the rest by passing it on
| otherwise = do
mm <- handleMess m mess
return (Left <$> mm)