[xmonad] Layout switching (rather than cycling)

Brent Yorgey byorgey at gmail.com
Fri Mar 28 15:00:32 EDT 2008


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/xmonad/attachments/20080328/86e2630d/attachment.htm


More information about the xmonad mailing list