[xmonad] Fwd: Patch to add new Layout message

Christian Wills cwills.dev at gmail.com
Thu Oct 2 02:55:48 UTC 2014


This can totally be done from your config only without having to modify the
core of Xmonad. I found this to be an interesting problem and slapped
together a solution that uses XMonad.Util.ExtensibleState.

I added the following to my xmonad.hs:

import qualified XMonad.Util.ExtensibleState as XS
.....
.....
data MasterPaneFlag = MasterPaneFlag { getFlag :: Bool }
    deriving (Show, Typeable)

instance ExtensionClass MasterPaneFlag where
    initialValue = MasterPaneFlag False

pickIncrFun :: Bool -> X ()
pickIncrFun flag = if flag then (sendMessage (IncMasterN (-1))) else
(sendMessage (IncMasterN 1))

toggleMasterPane :: X ()
toggleMasterPane  = do
    flag <- XS.get
    XS.modify(MasterPaneFlag . not . getFlag)
    pickIncrFun (getFlag flag)
.....
.....
--- Add a key binding that calls toggleMasterPane, for me that looks like
this
,   ("M-v", toggleMasterPane)


I find the ExtensibleState module allows you to do all sorts of tricks.


- Chris Wills



On Wed, Oct 1, 2014 at 9:10 PM, Brandon Allbery <allbery.b at gmail.com> wrote:

> On Wed, Oct 1, 2014 at 7:03 PM, Devin Mullins <devin.mullins at gmail.com>
> wrote:
>
>> I think another option is to make a new instance of LayoutClass that is
>> just like Tall except for also supporting this message. In fact, you should
>> be able to delegate to Tall for most definitions. Just writing off the cuff
>> - could be wrong.
>>
>
> Delegating to Tall won't work; you'd have to copy the definition and
> modify it, like I suggested for (|||).
>
> --
> brandon s allbery kf8nh                               sine nomine
> associates
> allbery.b at gmail.com
> ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>
> _______________________________________________
> xmonad mailing list
> xmonad at haskell.org
> http://www.haskell.org/mailman/listinfo/xmonad
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20141001/887f978c/attachment-0001.html>


More information about the xmonad mailing list