forked from anishathalye/dotfiles_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
original.xmonad.hs
534 lines (480 loc) · 23.3 KB
/
original.xmonad.hs
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
-- 2015-05-12 https://gist.github.com/doitian/1019203
{-# OPTIONS_GHC -fcontext-stack=32 #-}
import XMonad hiding ( (|||) )
import qualified XMonad.StackSet as W
import Control.OldException(catchDyn,try)
import Data.Char (toLower)
import Data.List (intercalate, intersperse, isSuffixOf, isPrefixOf)
import qualified Data.Map as M (fromList)
import System.Exit (exitSuccess)
import System.Posix (sleep)
import XMonad.Actions.CopyWindow
import XMonad.Actions.CycleWS (findWorkspace, nextScreen, prevScreen, swapNextScreen, swapPrevScreen, toggleOrDoSkip, WSType(..))
import XMonad.Actions.CycleWindows
import XMonad.Actions.DynamicWorkspaces
import XMonad.Actions.FloatKeys
import XMonad.Actions.Promote
import XMonad.Actions.UpdateFocus
import XMonad.Actions.WindowGo
import XMonad.Actions.WithAll
import XMonad.Layout hiding ( (|||) )
import XMonad.Layout.Dishes
import XMonad.Layout.DwmStyle
import XMonad.Layout.Grid
import XMonad.Layout.IM
import XMonad.Layout.LayoutCombinators
import XMonad.Layout.LayoutHints
import XMonad.Layout.AutoMaster
import XMonad.Layout.Named
import XMonad.Layout.NoBorders
import XMonad.Layout.OneBig
import XMonad.Layout.PerWorkspace
import XMonad.Layout.Reflect
import XMonad.Layout.ResizableTile
import XMonad.Layout.Tabbed
import XMonad.Layout.ToggleLayouts
import XMonad.Layout.TwoPane
import XMonad.Layout.WindowNavigation
import qualified XMonad.Layout.Magnifier as Mag
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops (ewmh)
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Hooks.UrgencyHook
import XMonad.Prompt
import XMonad.Prompt.AppLauncher as AL
import XMonad.Prompt.Window
import XMonad.Util.EZConfig
import XMonad.Util.NamedScratchpad
import XMonad.Util.NamedWindows (getName)
import XMonad.Util.Run
import XMonad.Util.WorkspaceCompare (getSortByIndex)
-- Other usefull package
-- Desktop Gadgets
-- > import XMonad.Layout.Monitor
-- Title Bar
-- > import XMonad.Layout.NoFrillsDecoration
-- Dependencids
-- xdotool, wmctrl
myTerminal = "urxvt"
myBorderWidth = 2
myModMask = mod4Mask
myNumlockMask = mod2Mask
myNormalBorderColor = "#4B4B4B"
myFocusedBorderColor = "#60B48A"
myActiveBorderColor = "#808080"
-- shell prompt theme
mySP = defaultXPConfig
{ font = "xft:WenQuanYi Micro Hei Mono:pixelsize=14"
, bgColor = "#2B2B2B"
, fgColor = "#DCDCCC"
, bgHLight = "#4F4F4F"
, fgHLight = "#DCDCCC"
, borderColor = "#6F6F6F"
, promptBorderWidth = 1
, position = Top
, height = 22
, defaultText = []
}
myAutoSP = mySP { autoComplete = Just 1000 }
myWaitSP = mySP { autoComplete = Just 1000000 }
data LibNotifyUrgencyHook = LibNotifyUrgencyHook deriving (Read, Show)
instance UrgencyHook LibNotifyUrgencyHook where
urgencyHook LibNotifyUrgencyHook w = do
name <- getName w
ws <- gets windowset
c <- withDisplay $ \d -> fmap resClass $ io $ getClassHint d w
whenJust (W.findTag w ws) (flash name c)
where flash _ "Pidgin" _ = spawn "true"
flash _ "emesene" _ = spawn "true"
flash name c index = spawn $
intercalate " " $
[ "notify-send -i"
, icon
, show $ show name
, show $ "on " ++ index ]
where icon = case c of
"URxvt" -> "gnome-terminal"
otherwise -> map toLower c
focusUrgent' :: X ()
focusUrgent' = withUrgents $ (windows . focusOrSwitch)
where
focusOrSwitch (w:_) = W.focusWindow w
focusOrSwitch _ = W.greedyView =<< W.tag . head . namedScratchpadFilterOutWorkspace . W.hidden
myDzenPP h = defaultPP
{ ppOutput = hPutStrLn h
, ppCurrent = dzenColor "#0F1A0F" myFocusedBorderColor . pad
, ppVisible = dzenColor myFocusedBorderColor "#0F1A0F" . pad . dzenSwitchWs
, ppUrgent = dzenColor "#DCA3A3" "" . pad . dzenSwitchWs . dzenStrip
, ppHidden = pad . dzenSwitchWs
, ppLayout = dzenColor "#dfaf8f" "" . wrap " ^ca(1,xdotool key Super_L+backslash)[" "]^ca() "
, ppTitle = dzenColor "#DCDCCC" "" . dzenEscape
, ppSep = ""
, ppWsSep = "^fg(#0F1A0F)^r(2x16)^fg()"
, ppSort = fmap (.namedScratchpadFilterOutWorkspace) getSortByIndex
, ppExtras = [ppScreens]
}
where ppScreens = do ws <- gets windowset
let cv = [W.current ws] ++ W.visible ws
tags = map (\w -> (show $ fromIntegral $ W.screen w) ++ "." ++ (W.tag $ W.workspace w)) cv
return $ Just ("\0000" ++ concat (intersperse "\0000" tags))
dzenSwitchWs :: String -> String
dzenSwitchWs s = "^ca(1,switch-workspace.rb " ++ (show s) ++ ")" ++ s ++ "^ca()"
myTheme :: Theme
myTheme = defaultTheme
{ fontName = "xft:WenQuanYi Micro Hei:pixelsize=14"
, decoHeight = 20
, decoWidth = 400
, activeColor = "#1E2320"
, inactiveColor = "#3F3F3F"
, urgentColor = "#3F3F3F"
, activeBorderColor = "#6F6F6F"
, inactiveBorderColor = "#3F3F3F"
, urgentBorderColor = "#1E2320"
, activeTextColor = "#F0DFAF"
, inactiveTextColor = "#DCDCCC"
, urgentTextColor = "#CC9393"
}
pads = [ NS "term" "urxvt -name scratchpad -e sh -l -c 'tmux has -t quake && tmux attach -t quake || tmux new -s quake'" (resource =? "scratchpad" <&&> className =? "URxvt") (customFloating $ W.RationalRect 0.2 0.6 0.6 0.4)
, NS "stardict" "killall stardict; stardict" (className =? "Stardict") (customFloating $ W.RationalRect 0 0.5 0.4 0.5)
]
-- unused char
-- a, x, y, ', m
myKeys = \conf -> mkKeymap conf $
[ ("M-S-<Return>", spawn $ XMonad.terminal conf) -- terminal
, ("M-`", namedScratchpadAction pads "term") -- quake terminal
, ("M-d", namedScratchpadAction pads "stardict") -- quake dict
-- prompt
, ("M-p g", windowPromptGoto myWaitSP) -- window go prompt
, ("M-p b", windowPromptBring myWaitSP) -- window bring prompt
, ("M-p d", AL.launchApp mySP { defaultText = "~" } "pcmanfm" ) -- file manager prompt
, ("M-p o", AL.launchApp mySP "xopen" ) -- open prompt
, ("M-g", runOrRaise "window-go.sh" (resource =? "WindowGo" <&&> className =? "Gpicker")) -- window go
, ("M-b", runOrRaise "window-bring.sh" (resource =? "WindowBring" <&&> className =? "Gpicker")) -- window bring
, ("M-<Return>", raiseMaybe (spawn "gmrun") (className =? "Gmrun")) -- gmrun
, ("M-S-s", spawn "x-www-browser \"http://www.google.com/search?q=`xclip -o`\"") -- search selection
, ("M-S-o", spawn "xopen -") -- open current selection
-- app
, ("M-o", runOrRaiseNext "firefox" (className =? "Firefox")) -- chrome
, ("M-i", runOrRaiseNext "emacs-dwim" (className =? "Emacs")) --emacs
, ("M-u", runOrRaiseNext "urxvt" (className =? "URxvt" <&&> resource /=? "scratchpad")) -- raise next terminal
, ("M-c t", raiseNextMaybe (spawn "urxvt -name htop -e htop") (resource =? "htop")) -- Top
, ("M-c f", raiseNextMaybe (spawn "pcmanfm") (resource =? "Pcmanfm")) -- File Manager
, ("M-c h", spawn "xmonad-key.sh") -- Help
, ("M-c i", spawn "xp") -- Window Info
, ("M-c x", spawn "xkill") -- Kill X app
, ("M-c d", spawn "dropbox stop && dropbox start") -- Restart Dropbox
, ("M-c S-d", spawn "notify-send -i dropbox `dropbox status`") -- Dropbox Status
, ("M-c c", runOrRaiseNext "gsimplecal" (className =? "Gsimplecal")) --gsimplecal
-- client
, ("M-S-c", kill1) -- kill
, ("M-C-c", kill) -- kill all
, ("M-C-S-c", kill) -- kill all
, ("M-S-<Backspace>", kill1) -- kill
, ("M-S-<Backspace>", kill1) -- kill
, ("M-c M-S-c", killAll) -- kill
, ("M-S-=", windows copyToAll) -- copy to all
, ("M-=", killAllOtherCopies) -- kill others
, ("M-C-S-=", kill) -- kill all
-- make sure mod matches keysym
, ("M-a", rotUnfocusedDown)
, ("M-S-a", rotUnfocusedUp)
, ("M-<Tab>", windows W.focusDown) -- focus down
, ("M-S-<Tab>", windows W.focusUp) -- focus up
, ("M-C-<Tab>", rotFocusedDown) -- focus down
, ("M-C-S-<Tab>", rotFocusedUp) -- focus up
, ("M-<Page_Down>", rotFocusedDown) -- focus down
, ("M-<Page_Up>", rotFocusedUp) -- focus up
, ("M-;", windows W.focusMaster) -- focus master
, ("M-S-;", promote) -- promote to master
, ("M-z", focusUrgent) -- focus urgent
, ("M-S-<Page_Down>", windows W.swapDown ) -- swap down
, ("M-S-<Page_Up>", windows W.swapUp ) -- swap up
, ("M-[", sendMessage Shrink) -- shrink master
, ("M-]", sendMessage Expand) -- expand master
, ("M-S-[", sendMessage MirrorShrink) -- shrink window in slave pane
, ("M-S-]", sendMessage MirrorExpand) -- expand window in slave pane
, ("M-h", sendMessage $ Go L) -- focus left
, ("M-j", sendMessage $ Go D) -- focus down
, ("M-k", sendMessage $ Go U) -- focus up
, ("M-l", sendMessage $ Go R) -- focus right
, ("M-S-h", sendMessage $ Swap L) -- swap left
, ("M-S-j", sendMessage $ Swap D) -- swap down
, ("M-S-k", sendMessage $ Swap U) -- swap up
, ("M-S-l", sendMessage $ Swap R) -- swap right
, ("M-C-h", sendMessage $ Move L) -- move left
, ("M-C-j", sendMessage $ Move D) -- move down
, ("M-C-k", sendMessage $ Move U) -- move up
, ("M-C-l", sendMessage $ Move R) -- move right
-- float
, ("M-<L>", withFocused (keysMoveWindow (-20,0))) -- move float left
, ("M-<R>", withFocused (keysMoveWindow (20,0))) -- move float right
, ("M-<U>", withFocused (keysMoveWindow (0,-20))) -- move float up
, ("M-<D>", withFocused (keysMoveWindow (0,20))) -- move float down
, ("M-S-<L>", withFocused (keysResizeWindow (-20,0) (0,0))) --shrink float at right
, ("M-S-<R>", withFocused (keysResizeWindow (20,0) (0,0))) --expand float at right
, ("M-S-<D>", withFocused (keysResizeWindow (0,20) (0,0))) --expand float at bottom
, ("M-S-<U>", withFocused (keysResizeWindow (0,-20) (0,0))) --shrink float at bottom
, ("M-C-<L>", withFocused (keysResizeWindow (20,0) (1,0))) --expand float at left
, ("M-C-<R>", withFocused (keysResizeWindow (-20,0) (1,0))) --shrink float at left
, ("M-C-<U>", withFocused (keysResizeWindow (0,20) (0,1))) --expand float at top
, ("M-C-<D>", withFocused (keysResizeWindow (0,-20) (0,1))) --shrink float at top
-- layout
, ("M-\\", sendMessage NextLayout) -- toggle layouts
, ("M-S-\\", myLayoutPrompt) -- layout prompt
, ("M-C-\\", setLayout $ XMonad.layoutHook conf) -- reset layout
, ("M-f", sendMessage (Toggle "Full")) -- toggle Full
, ("M-<Escape>", sendMessage ToggleStruts) -- toggle panel
, ("M-t", withFocused $ windows . W.sink) -- sink focused window
, ("M-S-t", sinkAll) -- sink all windows
, ("M-C-[", sendMessage (IncMasterN 1)) -- increase master windows number
, ("M-C-]", sendMessage (IncMasterN (-1))) --decrease master windows number
-- system
, ("M-C-S-q", io (exitHook >> exitSuccess)) -- exit
, ("M-S-q", broadcastMessage ReleaseResources >> io exitHook >> restart "xmonad" True) -- restart
, ("M-c M-C-S-q", io $ runProcessWithInput "emacs-dwim" ["-q"] "" >> spawn "gksu /sbin/poweroff") -- poweroff
, ("M-c M-C-S-r", io $ runProcessWithInput "emacs-dwim" ["-q"] "" >> spawn "gksu /sbin/reboot") -- reboot
, ("M-q", refresh) -- refresh
-- cycle through workspaces
, ("M-n", withWorkspace' (windows . W.greedyView)) -- workspace prompt gready
, ("M-m", withWorkspace' (windows . W.view)) -- workspace prompt
, ("M-S-n", withWorkspace' (windows . W.shift)) -- workspace shift prompt
, ("M-C-n", withWorkspace' (windows . copy)) -- workspace copy prompt
, ("M-C-S-n", renameWorkspace mySP) -- rename workspace
, ("M-C-S-<Backspace>", removeWorkspace) -- delete empty workspace
, ("M-/", toggleWSNoSP) -- toggle recently visited workspaces
]
++
-- "M-[1..9,0,-]" -- Switch to workspace N
-- "M-S-[1..9,0,-]" -- Move client to workspace N
-- "M-C-[1..9,0,-]" -- Copy client to workspace N
[("M-" ++ m ++ [k], windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) (['1' .. '9'] ++ ['0', '-'])
, (f, m) <- [ (W.greedyView, "")
, (W.shift, "S-")
, (copy, "C-")
]
]
++
-- "M-C-S-[1..9,0,-]" -- Move client to workspace N and follow
[("M-C-S-" ++ [k], (windows $ W.shift i) >> (windows $ W.greedyView i))
| (i, k) <- zip (XMonad.workspaces conf) (['1' .. '9'] ++ ['0', '-'])
]
++
-- "M-{w,e,r}" -- Switch to physical/Xinerama screens 1, 2, or 3
-- "M-S-{w,e,r}" -- Move client to screen 1, 2, or 3
--
[("M-" ++ m ++ k, screenWorkspace sc >>= flip whenJust (windows . f))
| (k, sc) <- zip ["w", "e", "r"] [0..]
, (f, m) <- [(W.view, ""), (W.shift, "S-")]]
++
[ ("M-'", prevScreen) -- Prev Screen
, ("M-S-'", swapNextScreen) -- Swap next screen
]
++
-- HiddenNonEmptyWS
[ ("M-.", windows . W.greedyView =<< findWorkspace getSortByIndexNoSP Next HiddenNonEmptyWS 1) -- go to next workspace
, ("M-,", windows . W.greedyView =<< findWorkspace getSortByIndexNoSP Prev HiddenNonEmptyWS 1) -- go to prev workspace
, ("M-S-.", windows . W.shift =<< findWorkspace getSortByIndexNoSP Next HiddenNonEmptyWS 1) -- shift to next workspace
, ("M-S-,", windows . W.shift =<< findWorkspace getSortByIndexNoSP Prev HiddenNonEmptyWS 1) -- shift to prev workspace
-- move window to and focus HiddenNonEmpty wss except scratchpad
, ("M-C-S-.", shiftAndView' Next) -- shift to next workspace and follow
, ("M-C-S-,", shiftAndView' Prev) -- shift to prev workspace and follow
]
where
getSortByIndexNoSP =
fmap (.namedScratchpadFilterOutWorkspace) getSortByIndex
shiftAndView' dir = findWorkspace getSortByIndexNoSP dir AnyWS 1
>>= \t -> (windows . W.shift $ t) >> (windows . W.greedyView $ t)
toggleWSNoSP = windows $ W.greedyView =<< W.tag . head . namedScratchpadFilterOutWorkspace . W.hidden
role = stringProperty "WM_WINDOW_ROLE"
dmenuXinerama :: [String] -> X String
dmenuXinerama opts = do
curscreen <- (fromIntegral . W.screen . W.current) `fmap` gets windowset :: X Int
io $ runProcessWithInput "dmenu" ["-m", show curscreen] (unlines opts)
withWorkspace' :: (String -> X ()) -> X ()
withWorkspace' job = do sort <- fmap (.namedScratchpadFilterOutWorkspace) getSortByIndex
ws <- gets (map W.tag . sort . W.workspaces . windowset)
w <- dmenuXinerama ws
let w' = case reverse w of
'\n':xs -> reverse xs
otherwise -> w
in case w' of (_:_)
| w' `elem` ws -> job w'
| otherwise -> addHiddenWorkspace w' >> job w'
myLayoutPrompt :: X ()
myLayoutPrompt = do l <- dmenuXinerama layouts
case reverse l of
'\n':xs -> let l' = reverse xs
in sendMessage $ JumpToLayout $ drop 2 l'
where
layouts = ["1.tall", "2.wide", "3.2col", "4.2row", "5.tab", "6.grid", "7.big", "8.dish"]
myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
[ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w))
, ((modMask, button2), (\w -> focus w >> windows W.swapMaster))
-- you may also bind events to the mouse scroll wheel (button4 and button5)
-- forward,backward button8 and button9
, ((0, 8), (\w -> windows . W.greedyView =<< findWorkspace getSortByIndexNoSP Next HiddenNonEmptyWS 1)) -- go to next workspace
, ((0, 9), (\w -> windows . W.greedyView =<< findWorkspace getSortByIndexNoSP Prev HiddenNonEmptyWS 1)) -- go to prev workspace
]
where
getSortByIndexNoSP =
fmap (.namedScratchpadFilterOutWorkspace) getSortByIndex
------------------------------------------------------------------------
-- Layouts:
myLayout = avoidStruts
$ configurableNavigation (navigateColor myActiveBorderColor)
$ toggleLayouts (Full)
$ smartBorders
$ onWorkspace "7.gimp" gimp'
$ onWorkspace "9.im" im'
$ onWorkspace "-" magG'
$ layouts
where
layouts = tall' ||| wide' ||| col2' ||| row2' ||| tabs' ||| magG' ||| big' ||| dish'
tall' = named "tall" $ layoutHints $ deco tall
wide' = named "wide" $ layoutHints $ deco wide
col2' = named "2col" $ layoutHints $ deco $ TwoPane delta ratio
row2' = named "2row" $ layoutHints $ deco $ Mirror $ TwoPane delta ratio
tabs' = named "tab" $ layoutHints $ tabs
magG' = named "grid" $ layoutHints $ deco magG
masterG' = named "grid" $ layoutHints $ deco masterG
big' = named "big" $ layoutHints $ deco $ OneBig (3/4) (3/4)
dish' = named "dish" $ layoutHints $ deco dish
-- per work space layouts, single quote indicates modifiers
gimp' = named "gimp" $ layoutHints $ gimp
im' = named "im" $ layoutHints $ im
-- basic layouts
dish = Dishes nmaster (1/6)
tall = ResizableTall nmaster delta ratio []
wide = Mirror tall
tabs = tabbed shrinkText myTheme
masterG = Mirror $ autoMaster nmaster (fromRational delta) $ Mirror magG
magG = Mag.magnifiercz 1.15 Grid
deco = dwmStyle shrinkText myTheme
gimp = withIM (0.2) (Role "gimp-toolbox")
$ reflectHoriz
$ withIM (0.18) (Role "gimp-dock") tabs
im = withIM (1/7) imRoster $ reflectHoriz $ withIM (1/5) imRightRoster Grid
-- parameters
nmaster = 1
ratio = 1/2
delta = 3/100
imRoster = (ClassName "emesene" `And` Role "main")
`Or` (ClassName "Pidgin" `And` Role "buddy_list")
`Or` (ClassName "Empathy" `And` Role "contact_list")
imRightRoster = (ClassName "Skype" `And` Role "MainWindow")
myWorkspaces = ["1.sys","2.www","3.emacs","4.doc","5","6","7.gimp","8.sns","9.im","0","-"]
myFloatManageHook = composeOne . concat $
[ [ (isFullscreen -?> doFullFloat')
, (isDialog -?> doCenterFloat')
, (className =? "Emacs" <&&> resource =? "Ediff" -?> doFloat')
, (className =? "Pidgin" <&&> resource =? "multifield" -?> doFloat')
, (className =? "Gsimplecal" -?> doRectFloat' (W.RationalRect 0.75 0.02 0.25 0.23))
]
, [ className =? x -?> doFloat' | x <- cFloat ]
, [ className =? x -?> doCenterFloat' | x <- cCenter ]
, [ role =? x -?> doFloat' | x <- rFloat ]
, [ (className =? "Minefield" <||> className =? "Firefox") <&&> resource =? x -?> doCenterFloat'
| x <- ffCenter
]
, [ className =? x -?> doMaster | x <- masters ]
, [ className =? "Pidgin" <&&> role =? "buddy_list" -?> doMaster ]
-- , [ return True -?> doF W.swapDown ] -- prevent changing master
]
where
unFloat = ask >>= doF . W.sink
cFloat = [ "Zenity", "Airappinstaller",
"Gcolor2", "Gpicker", "Stardict", "Update-manager", "Shutter" ]
rFloat = ["gimp-toolbox-color-dialog", "gimp-brightness-contrast-tool", "gimp-color-selector"]
ffCenter = [ "Manager", "Extension", "Download", "Dialog", "Browser", "Toplevel" ]
cCenter = [ "Gmrun" ]
masters = [ "Emacs" ]
doMaster = doF W.shiftMaster
doFloat' = doFloat <+> doMaster
doCenterFloat' = doCenterFloat <+> doMaster
doFullFloat' = doFullFloat <+> doMaster
doRectFloat' r = doRectFloat r <+> doMaster
role = stringProperty "WM_WINDOW_ROLE"
myShiftManageHook = composeOne . concat $
[ [ transience ]
, [ className =? c -?> doShift t
| (c, t) <- [ ("Pidgin", "9.im")
, ("Skype", "9.im")
, ("Gimp-2.6", "7.gimp")
, ("Gimp", "7.gimp")
, ("Emacs", "3.emacs")
]
]
, [ resource =? r -?> doShift t
| (r, t) <- [ ("DTA", "0") ]
]
]
myManageHook = namedScratchpadManageHook pads
<+> myShiftManageHook
<+> myFloatManageHook
<+> manageDocks
myHandleEventHook = focusOnMouseMove
-- Whether focus follows the mouse pointer.
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True
------------------------------------------------------------------------
-- Startup hook
-- Perform an arbitrary action each time xmonad starts or is restarted
-- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize
-- per-workspace layout choices.
--
-- By default, do nothing.
myStartupHook = adjustEventInput
>> setWMName "LG3D"
exitHook :: IO ()
exitHook = do
return ()
------------------------------------------------------------------------
-- Now run xmonad with all the defaults we set up.
-- Run xmonad with the settings you specify. No need to modify this.
--
main = do
dzen <- spawnPipe "xmonad.panel"
xmonad $ ewmh $ withUrgencyHook LibNotifyUrgencyHook defaultConfig
{ terminal = myTerminal
, focusFollowsMouse = myFocusFollowsMouse
, borderWidth = myBorderWidth
, modMask = myModMask
, numlockMask = myNumlockMask
, workspaces = myWorkspaces
, normalBorderColor = myNormalBorderColor
, focusedBorderColor = myFocusedBorderColor
-- key bindings
, keys = myKeys
, mouseBindings = myMouseBindings
-- hooks, layouts
, layoutHook = myLayout
, manageHook = myManageHook
, handleEventHook = myHandleEventHook
, logHook = (dynamicLogWithPP $ myDzenPP dzen)
>> setWMName "LG3D"
, startupHook = myStartupHook
}
`additionalKeys`
[ ((0, 0x1008ff18), AL.launchApp mySP { defaultText = "~" } "pcmanfm")
, ((0, 0x1008ff1b), spawn "xopen -")
, ((0, 0x1008ff19), namedScratchpadAction pads "mutt")
, ((0, 0x1008ff30), spawn "goodsong add")
, ((mod4Mask, 0x1008ff30), spawn "goodsong play")
, ((0, 0x1008ff1d), runOrRaise "gcalctool" (className =? "Gcalctool"))
, ((0, 0x1008ff26), spawn "mpc-osd prev")
, ((0, 0x1008ff27), spawn "mpc-osd next")
, ((0, 0x1008ff14), spawn "mpc-osd toggle")
, ((mod4Mask, 0x1008ff26), spawn "mpc-osd seek -5")
, ((mod4Mask, 0x1008ff27), spawn "mpc-osd seek +5")
, ((0, 0x1008ff13), spawn "volume-osd 2+")
, ((0, 0x1008ff11), spawn "volume-osd 2-")
, ((0, 0x1008ff12), spawn "volume-osd toggle")
, ((mod4Mask, 0x1008ff13), spawn "mpc-osd volume +5")
, ((mod4Mask, 0x1008ff11), spawn "mpc-osd volume -5")
, ((0, 0xff14), spawn "xscreensaver-command -lock || gnome-screensaver-command --lock")
, ((mod4Mask, 0xff61), spawn "shutter --full")
, ((mod4Mask .|. controlMask, 0xff61), spawn "shutter --selection")
]