]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - xmonad.hs
49082a4c064f35d1ce3cd0a45bf1550e3c68156a
[config/dotfiles.git] / xmonad.hs
1 -- XMonad configuration file.
2 --
3 -- Should work fine with XMonad 0.8 and above.
4
5
6 import XMonad
7 -- Necessary for reflectVert.
8 import XMonad.Layout.Reflect
9 -- Necessary for avoidMaster.
10 import qualified XMonad.StackSet as W
11 -- Necessary for smartBorders.
12 import XMonad.Layout.NoBorders
13
14
15 -- Prevent new windows from spawning in the master pane. Taken from
16 -- http://haskell.org/haskellwiki/Xmonad/Frequently_asked_questions on
17 -- 2009-06-30. Thanks.
18 avoidMaster :: W.StackSet i l a s sd -> W.StackSet i l a s sd
19 avoidMaster = W.modify' $ \c -> case c of
20     W.Stack t [] (r:rs) -> W.Stack t [r] rs
21     otherwise           -> c
22
23 -- Create my custom layout.
24 --
25 -- Only use horizontal (Mirror tiled) and fullscreen layouts.
26 --
27 -- The master pane is at the top of the screen. To make sure new windows don't
28 -- spawn in the master pane avoidMaster (see below) is used. Borders are only
29 -- drawn when the screen has more then one window (smartBorders).
30 --
31 -- Thanks to jrick in #xmonad on Freenode (2009-06-29 22:19) for telling me
32 -- how to remove the vertical tiled layout.
33 myLayoutHook = smartBorders $ Mirror tiled ||| Full
34     where
35     -- Default tiling algorithm partitions the screen into two panes.
36     tiled   = Tall nmaster delta ratio
37     -- The default number of windows in the master pane.
38     nmaster = 1
39     -- Percent of screen to increment by when resizing panes.
40     delta   = 3/100
41     -- Default proportion of screen occupied by master pane.
42     ratio   = 1/2
43
44 -- Don't spawn new windows in the master pane (which is at the top of the
45 -- screen). Thanks to dschoepe, aavogt and especially vav in #xmonad on
46 -- Freenode (2009-06-30 02:10f).
47 --
48 -- Also some applications are spawned on specific workspaces. Thanks to
49 -- dschoepe and ivanm in #xmonad on Freenode (2009-07-12 14:50).
50 myManageHook = composeAll
51     [ className =? "Iceweasel" --> doF (W.shift "2")
52     , className =? "Wireshark" --> doF (W.shift "3")
53     ] <+> doF avoidMaster
54
55 main = xmonad $ defaultConfig
56     -- Use Windows key as main key so it doesn't conflict with any other key
57     -- bindings.
58     { modMask = mod4Mask
59     -- Inactive borders are black - invisible on my black screen.
60     , normalBorderColor = "#000000"
61     -- Active border is dark red.
62     , focusedBorderColor = "#990000"
63     -- Use my layout and manage hooks (see above).
64     , layoutHook = myLayoutHook
65     , manageHook = myManageHook
66     -- Use unicode rxvt as my terminal.
67     , terminal = "urxvt"
68     }