.files/nix/configurations/vanadium/home/xmonad/lib/XMonad/Layout/SetMasterNTall.hs

30 lines
984 B
Haskell

{-# 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