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