1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
{-
Sean's second attempt at an XMonad configuration, after having learnt some Haskell
Much inspiration from Joey Hess's config
-}
import XMonad
import XMonad.Config.Xfce
import qualified XMonad.StackSet as W
import XMonad.Util.EZConfig (additionalKeysP, removeKeysP)
import XMonad.Actions.CycleWS (toggleWS)
import XMonad.Actions.RotSlaves
import XMonad.Actions.Submap
import XMonad.Hooks.InsertPosition
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Layout.Dishes
import XMonad.Layout.FixedColumn
import XMonad.Layout.Grid
-- import XMonad.Layout.LayoutHints
import XMonad.Layout.LimitWindows
import XMonad.Layout.Magnifier
import XMonad.Layout.Maximize
import XMonad.Layout.NoBorders
import XMonad.Layout.OnHost
import XMonad.Layout.PerWorkspace
import XMonad.Layout.ResizeScreen
import Control.Arrow hiding ((<+>), (|||))
import Control.Monad (liftM2)
import Data.Bits
import Data.List (isInfixOf)
import qualified Data.Map as M
main = xmonad $ addMyKeys $ xfceConfig
{ terminal = myTerm
, normalBorderColor = "#656555"
, focusedBorderColor = "#94BFF3"
, borderWidth = 1
, modMask = myMod
, workspaces = myWorkspaces
-- I would prefer to have newly created windows always inserted at the
-- top of the non-master area. But insertPosition doesn't support
-- that so let's always put them at the end.
, manageHook = insertPosition End Newer
<+> myManageHook
<+> manageHook xfceConfig
, layoutHook = myLayoutHook
}
-- basic preferences
myMod = mod4Mask
myTerm = "urxvtcd"
myEditor = "emacscd"
myBrowser = "iceweasel"
myWorkspaces = ["ops", "conn", "www", "comm", "view", "tail"]
-- key bindings
myPrefixedKeys = [ ("i", spawn "xmousetidy")
-- launchers
, ("g w", spawn myBrowser) -- could use `XMonad.Actions.WindowGo (runOrRaise)' here
, ("g e", spawn myEditor)
, ("g g", spawn myTerm)
-- , ("g m", spawn $ inMyTerm "sh -c 'offline || mbsync fastmail; mutt'")
, ("g m", spawn $ inMyTerm "mutt")
, ("g r", spawn $ inMyTerm "mutt -f ~/.fmail/feeds") -- 'r' for 'rss'
, ("g t", spawn $ inMyTerm "ii")
, ("g c", spawn $ inMyTerm "ncmpcpp") -- 'c' for chaones
, ("g v", spawn $ inMyTerm "alsamixer")
-- , ("g f", spawn "sh -c 'wmctrl -a Messenger || messengerfordesktop'")
-- window management
, ("o", windows W.focusDown)
, ("S-o", windows W.focusUp)
, (";", withFocused (sendMessage . maximizeRestore))
-- workspaces
, ("C-i", toggleWS)
]
myUnprefixedKeys = [ ("M4-j", windows W.focusDown)
, ("M4-k", windows W.focusUp)
-- Amazon Basics keyboard
, ("<XF86Tools>", spawn $ inMyTerm "ncmpcpp")
, ("<XF86Explorer>", spawn "thunar")
-- When locking the screen, also clear out my SSH
-- key. Otherwise it lasts until I log off. See
-- GNOME bugzilla bug #525574. Note that PGP
-- keys may be set to timeout, but SSH keys can't
-- be.
, ("M4-l", spawn "sh -c 'ssh-add -D && xscreensaver-command -lock'")
, ("M4-S-j", windows W.swapDown)
, ("M4-S-k", windows W.swapUp)
, ("M1-<Tab>", rotSlavesDown)
, ("M1-S-<Tab>", rotSlavesUp)
]
myUnwantedKeys = ["M-e"]
-- hooks
myFloatClasses = ["Gimp"
, "feh"
, "MPlayer"
, "Xfrun4"]
myManageHook = composeOne $
[ checkDock -?> doIgnore
, isDialog -?> doFloat
, className =? "Iceweasel" -?> doShift "www"
, className =? "libreoffice-impress" -?> doShift "view"
, className =? "Vlc" -?> doShift "view"
, className =? "Evince" -?> doShift "view"
, title =? "Dominion" -?> doShift "view"
, title =? "Messenger" -?> doShift "view"
, title =? "ii" -?> doShift "comm"
] ++ [className =? c -?> doFloat | c <- myFloatClasses]
myLayoutHook = modHost "artemis" (avoidStrutsOn []) $
modHost "zephyr" avoidStruts $
smartBorders $
-- layoutHintsWithPlacement (0.5, 0.5) $
onWorkspace "www" (maximize myWebLayout) $
onWorkspace "tail" (myDish ||| Full) $
onWorkspace "view" (Grid ||| Full) $
maximize myEditing ||| maximize Grid ||| myReadWriting ||| Full -- default for other workspaces
-- custom layouts
-- Set the fixed column layout to 90 columns to allow for 88 columns
-- of quoted e-mail text in mutt and the '> ' prefix. Then the
-- magnification setting of 1.31 allows slave mutt windows to display
-- their 90 columns properly on artemis' 1280x screen.
myEditing = modHost "zephyr" (limitWindows 7) $
modHost "artemis" (limitWindows 5) $
modHost "artemis" (magnifiercz' 1.31) $
onHost "artemis" (FixedColumn 1 20 90 10) $
Tall 1 0.03 0.55
myReadWriting = modHost "zephyr" (resizeHorizontal 600) $
modHost "zephyr" (resizeHorizontalRight 600) $
modHost "artemis" (resizeHorizontal 300) $
modHost "artemis" (resizeHorizontalRight 300) $
limitWindows 3 $
Dishes 1 (1/6)
myWebLayout = Mirror $ Tall 1 0.03 0.8
-- logs, compiles, tails etc.
myDish = limitWindows 5 $ Dishes 1 (1/5)
-- helper functions
inMyTerm :: String -> String
inMyTerm cmd = unwords $ [myTerm, "-e", cmd]
addMyKeys = addMyUnprefixed . prefixMainMap . addMyPrefixed . removeSomeDefaults
where
removeSomeDefaults conf = conf `removeKeysP` myUnwantedKeys
addMyPrefixed conf = conf `additionalKeysP` myPrefixedKeys
prefixMainMap conf = conf { keys = addPrefix
(controlMask, xK_i)
(keys conf) }
addMyUnprefixed conf = conf `additionalKeysP` myUnprefixedKeys
-- from <http://kojevnikov.com/xmonad-metacity-gnome.html>
addPrefix p ms conf =
M.singleton p . submap $ M.mapKeys (first chopMod) (ms conf)
where
mod = modMask conf
chopMod = (.&. complement mod)
|