1 -- XMonad configuration file.
3 -- Should work fine with XMonad 0.7 and above.
7 -- Necessary for reflectVert.
8 import XMonad.Layout.Reflect
9 -- Necessary for avoidMaster.
10 import qualified XMonad.StackSet as W
11 -- Necessary for toggleLayouts.
12 import XMonad.Layout.ToggleLayouts
13 -- Necessary for smartBorders.
14 import XMonad.Layout.NoBorders
15 -- Necessary for composeOne and -?>.
16 import XMonad.Hooks.ManageHelpers
17 -- Necessary for `additionalKeys`.
18 import XMonad.Util.EZConfig
19 -- Necessary for setWMName.
20 import XMonad.Hooks.SetWMName
23 -- Prevent new windows from spawning in the master pane. Taken from
24 -- http://haskell.org/haskellwiki/Xmonad/Frequently_asked_questions on
25 -- 2009-06-30. Thanks. Modified to not steal focus from the master pane when a
26 -- new window is created, thanks to vav in #xmonad on Freenode (2010-04-15
28 avoidMaster :: W.StackSet i l a s sd -> W.StackSet i l a s sd
29 avoidMaster = W.modify' $ \c -> case c of
30 W.Stack t [] (r:rs) -> W.Stack r [] (t:rs)
33 -- Create my custom layout.
35 -- Only use horizontal (Mirror tiled) and fullscreen layouts.
37 -- The master pane is at the top of the screen. To make sure new windows don't
38 -- spawn in the master pane avoidMaster (see below) is used. Borders are only
39 -- drawn when the screen has more then one window (smartBorders).
41 -- Thanks to jrick in #xmonad on Freenode (2009-06-29 22:19) for telling me
42 -- how to remove the vertical tiled layout.
44 -- toggleLayouts is used to allow switching to vertical tiled layout but not
45 -- using it with meta-space (see below in key bindings). Thanks to ml| in
46 -- #xmonad on Freenode (2010-06-14 09:49) how to use toggleLayouts.
47 myLayoutHook = toggleLayouts tiled $ smartBorders $ Mirror tiled ||| Full
49 -- Default tiling algorithm partitions the screen into two panes.
50 tiled = Tall nmaster delta ratio
51 -- The default number of windows in the master pane.
53 -- Percent of screen to increment by when resizing panes.
55 -- Default proportion of screen occupied by master pane.
58 -- Don't spawn new windows in the master pane (which is at the top of the
59 -- screen). Thanks to dschoepe, aavogt and especially vav in #xmonad on
60 -- Freenode (2009-06-30 02:10f).
62 -- Also some applications are spawned on specific workspaces. Thanks to
63 -- dschoepe and ivanm in #xmonad on Freenode (2009-07-12 14:50).
64 myManageHook = composeOne
66 [ className =? "Iceweasel" -?> doF (W.shift "2")
67 -- Miscellaneous on "3".
68 , className =? "Wireshark" -?> doF (W.shift "3")
69 , title =? "OpenOffice.org" -?> doF (W.shift "3") -- splash screen
70 , className =? "OpenOffice.org 2.4" -?> doF (W.shift "3")
71 , className =? "Vncviewer" -?> doF (W.shift "3")
73 , className =? "Wine" -?> doF (W.shift "4")
75 -- Don't spawn new windows in the master pane.
76 , return True -?> doF avoidMaster
77 -- Prevent windows which get moved to other workspaces from removing the
78 -- focus of the currently selected window. Thanks to vav in #xmonad on
79 -- Freenode (2010-04-15 21:04).
80 , return True -?> doF W.focusDown
84 -- Switch to additional layout (vertical tiled) defined by
85 -- toggleLayouts above.
86 ((mod4Mask, xK_v), sendMessage ToggleLayout)
89 -- When using multiple screens, switching to another workspace causes
90 -- Xmonad to pull the workspace to the current screen if it was also
91 -- displayed on another one. This is confusing for me so the following
92 -- code changes it to just switch to the screen where the workspace is
95 -- Thanks to the Xmonad FAQ, read on 2010-06-16 13:42
96 -- (http://www.haskell.org/haskellwiki/Xmonad/Frequently_asked_questions).
97 -- Thanks to MrElendig in #xmonad on Freenode (2010-06-17 17:16) to use
98 -- the default XMonad workspaces.
99 [((m .|. mod4Mask, k), windows $ f i)
100 | (i, k) <- zip (XMonad.workspaces defaultConfig) [xK_1 .. xK_9]
101 , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
103 main = xmonad $ defaultConfig
104 -- Use Windows key as main key as it doesn't conflict with any other key
107 -- Inactive borders are black - invisible on my black screen.
108 , normalBorderColor = "#000000"
109 -- Active borders are dark red.
110 , focusedBorderColor = "#990000"
111 -- Use my layout and manage hooks (see above).
112 , layoutHook = myLayoutHook
113 , manageHook = myManageHook
114 -- Use unicode rxvt as my terminal.
116 -- Necessary for Java so it recognizes XMonad as tiling window manager.
117 , startupHook = setWMName "LG3D"
119 `additionalKeys` myKeys