mirror of
https://codeberg.org/leana8959/.files.git
synced 2026-02-01 14:39:39 +00:00
vanadium/xmonad: use event handling to set master pane count
This commit is contained in:
parent
e65e37d3a9
commit
084261c58e
3 changed files with 64 additions and 21 deletions
|
|
@ -0,0 +1,30 @@
|
|||
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}
|
||||
|
||||
-- Wraps ResizableTall, allows setting master count to a number directly
|
||||
module XMonad.Layout.SetMasterNTall
|
||||
( SetMasterNTall(..)
|
||||
, SetMasterN(..)
|
||||
) where
|
||||
|
||||
import XMonad
|
||||
import qualified XMonad.StackSet as W
|
||||
import XMonad.Layout.ResizableTile
|
||||
|
||||
-- Message
|
||||
data SetMasterN = SetMasterN Int
|
||||
instance Message SetMasterN
|
||||
|
||||
-- Layout
|
||||
newtype SetMasterNTall a = SetMasterNTall { unSetMasterNTall :: ResizableTall a }
|
||||
deriving (Read, Show)
|
||||
|
||||
instance LayoutClass SetMasterNTall a where
|
||||
runLayout (W.Workspace t l s) =
|
||||
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
|
||||
| otherwise = (fmap . fmap) SetMasterNTall . handleMessage l $ mess
|
||||
|
||||
description (SetMasterNTall l) = description l
|
||||
Loading…
Add table
Add a link
Reference in a new issue