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