haskellfunctional-programmingxmonad

How do I write the action to loop through layouts?


Currently, I have Super+Space to loop though the layouts, which is the default.

I would like to bind that action to another key combination, e.g. Super+Shift+Space, in order to let the original one free for a launcher application (which is a lot in my muscle memory as I use i3, whereas my muscle memory has nothing to loop though layouts, so I can absorb any new one for it).

My understanding is that I should so something like this

def { {- my defaults -} }
    `removeKeysP` ["M-<Space>"]
    `additionalKeysP` myKeys

myKeys = ("M-S-<Space>", ???) : [{- other stuff -}]

but I don't know how to write the action ???; the only think I (think I) know is that its type should be X (). Well, thanks :D

Besides giving me a solution, would you mind helping me undestand how I should have found it myself? I do use HLS in my IDE, but I'm not sure how to use it I don't even know in which module I'd find what I look for.


Solution

  • The initial config is defined in https://github.com/xmonad/xmonad/blob/master/src/XMonad/Config.hs. On line 193, you can find the message triggered by Mod+Space:

    sendMessage NextLayout
    

    You may also be interested in looking through more elaborate Actions from contrib in https://xmonad.github.io/xmonad-docs/xmonad-contrib/, like CycleSelectedLayouts for example.