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