[xmonad] Layout switching (rather than cycling)

Anze Slosar anze at berkeley.edu
Fri Mar 28 17:37:27 EDT 2008


Brent,

Works like magic, thanks! I love xmonad!

anze

phone: +1 (510) 495 2488, mobile: +1 (510) 289 9395, fax: +1 (510) 486 7149
-- "Of course any comparisons between the two men are absurd. One's a
     bearded, long-winded Communist dictator who tolerates no dissent;
     the other one speaks Spanish." [/. on difference between RMS
     and Castro]


On Fri, 28 Mar 2008, Brent Yorgey wrote:

> On Fri, Mar 28, 2008 at 2:45 PM, Anze Slosar <anze at berkeley.edu> wrote:
>
>> Hi,
>>
>> How can I bind certain layouts to key combinations? So rather than cycle
>> thorugh layouts with Mod Space, I'd like Mod F1 to give me layout 1, Mod
>> F2 to give me layout 2, etc... I've been googling for a bit, but can't
>> find an answer.
>>
>> Thanks.
>>
>> anze
>>
>
> Hi Anze,
>
> You can do this using the JumpToLayout message from the
> XMonad.Layout.LayoutCombinators extension module.  For example:
>
> import XMonad hiding ( (|||) )  -- don't use the normal ||| operator
> import XMonad.Layout.LayoutCombinators   -- use the one from
> LayoutCombinators instead
> import XMonad.Util.EZConfig  -- add keybindings easily
>
> main = xmonad myConfig
>
> myConfig = defaultConfig {
>  ...
>  layoutHook = tall ||| Mirror tall ||| Full
>  ...
> } `additionalKeysP`
>  [ ("M-<F1>", sendMessage $ JumpToLayout "Tall")
>  , ("M-<F2>", sendMessage $ JumpToLayout "Mirror Tall")
>  , ("M-<F3>", sendMessage $ JumpToLayout "Full")
>  ]
>
> tall = Tall 1 (3/100) (1/2)
>
>
>
> Untested, but that's the basic idea, hopefully that will get you going on
> the right track.  Let us know if you've got more questions.
>
> -Brent
>


More information about the xmonad mailing list