]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - xmonad.hs
xmonad.hs: Only draw borders when necessary.
[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 myManageHook = doF avoidMaster
47
48 main = xmonad $ defaultConfig
49     -- Use Windows key as main key so it doesn't conflict with any other key
50     -- bindings.
51     { modMask = mod4Mask
52     -- Inactive borders are black - invisible on my black screen.
53     , normalBorderColor = "#000000"
54     -- Active border is dark red.
55     , focusedBorderColor = "#990000"
56     -- Use my layout and manage hooks (see above).
57     , layoutHook = myLayoutHook
58     , manageHook = myManageHook
59     }