[xmonad] one minor annoyance - default layout for screen

Sean Allen sean at monkeysnatchbanana.com
Wed Jan 26 02:53:44 CET 2011


I've now been using xmonad inside of gnome for about a week... slowly
removing the gnome aspects of everything...
in the meantime I have one annoyance.
I have a dual monitor setup where I wanted to have sep. workspaces for
each monitor. That wasn't a problem to get setup...
but the 2nd monitor, I want to split the layout horizontally rather
than vertically...
I can accomplish this with:

 layoutHook = reflectHoriz $ Tall 1 (3/100) (1/2)

But... I don't know enough Haskell to combine that together with my
existing gnome friendly layout hook.

A this is the code you want plus, go look at this bit of haskell to
learn why it works would be greatly appreciated.

Current hook is:

  layoutHook  = smartBorders (layoutHook gnomeConfig)

Entire current xmonad.hs is:

import XMonad
import XMonad.Actions.UpdatePointer
import XMonad.Config.Gnome
import XMonad.Hooks.DynamicLog
import XMonad.Layout.IndependentScreens
import XMonad.Layout.NoBorders
import qualified XMonad.StackSet as W
import XMonad.Util.EZConfig (additionalKeys)

conf = gnomeConfig {
  workspaces = myWorkspaces
  , modMask = mod4Mask
  , terminal = "gnome-terminal"
  , layoutHook  = smartBorders (layoutHook gnomeConfig)
  , logHook = dynamicLog >> updatePointer (Relative 0.5 0.5)
  } `additionalKeys` myKeys

myWorkspaces = withScreens 2 ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
               `
myKeys =
  [
    -- workspaces are distinct by screen
    ((m .|. mod4Mask, k), windows $ onCurrentScreen f i)
  | (i, k) <- zip (workspaces' conf) [xK_1 .. xK_9]
  , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]
  ]
  ++
  [
    -- swap screen order
    ((m .|. mod4Mask, key), screenWorkspace sc >>= flip whenJust (windows . f))
               | (key, sc) <- zip [xK_w, xK_e, xK_r] [1,0,2]
               , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
         ++
  [
    -- rebind meta-p to dmenu
    ((mod4Mask, xK_p), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")
  ]

main = xmonad conf



More information about the xmonad mailing list