-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxmonad.hs
617 lines (524 loc) · 26.4 KB
/
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
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
-------------------------------------------------------------------------------
-- --
-- XMonad Configuration --
-- --
----------------------------------------------------------------------------}}}
-- IMPORTS {{{
-------------------------------------------------------------------------------
import Data.Default (def)
import Data.Monoid (Endo)
import qualified Data.Map as M
import System.IO (hClose)
import System.Taffybar.Hooks.PagerHints (pagerHints)
import XMonad hiding ((|||))
import XMonad.Actions.ConditionalKeys (bindOn, XCond(..))
import XMonad.Actions.CycleWS
import XMonad.Actions.DynamicProjects (Project(..), dynamicProjects)
import XMonad.Actions.DynamicWorkspaces
import XMonad.Actions.MessageFeedback (tryMessage_)
import XMonad.Actions.Navigation2D
import XMonad.Actions.Promote
import XMonad.Actions.SpawnOn (manageSpawn, spawnOn)
import XMonad.Actions.WithAll (sinkAll, killAll)
import XMonad.Hooks.EwmhDesktops (ewmh)
import XMonad.Hooks.FadeWindows
import XMonad.Hooks.InsertPosition
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Layout.Accordion
import XMonad.Layout.BinarySpacePartition
import XMonad.Layout.DecorationMadness
import XMonad.Layout.Fullscreen
import XMonad.Layout.Gaps
import XMonad.Layout.Hidden
import XMonad.Layout.LayoutCombinators
import XMonad.Layout.MultiToggle
import XMonad.Layout.MultiToggle.Instances
import XMonad.Layout.NoFrillsDecoration
import XMonad.Layout.PerScreen
import XMonad.Layout.Reflect
import XMonad.Layout.Renamed
import XMonad.Layout.ResizableTile
import XMonad.Layout.Simplest
import XMonad.Layout.ShowWName
import XMonad.Layout.Spacing
import XMonad.Layout.SubLayouts
import XMonad.Layout.Tabbed
import XMonad.Layout.ThreeColumns
import XMonad.Layout.WindowNavigation
import XMonad.Prompt
import XMonad.Prompt.ConfirmPrompt
import qualified XMonad.StackSet as W
import XMonad.Util.EZConfig (mkNamedKeymap)
import XMonad.Util.NamedActions (NamedAction(..), addDescrKeys', (^++^), subtitle, addName, showKm)
import XMonad.Util.NamedScratchpad
import XMonad.Util.Run (spawnPipe, hPutStr)
import XMonad.Util.WorkspaceCompare (getSortByIndex)
import XMonad.Util.XSelection (getSelection)
----------------------------------------------------------------------------}}}
-- Main {{{
-------------------------------------------------------------------------------
main :: IO ()
main =
xmonad
$ addDescrKeys' ((myModMask, xK_F1), showKeybindings) myKeys
$ dynamicProjects projects
$ docks
$ ewmh
$ pagerHints
$ withNavigation2DConfig myNav2DConfig
$ myConfig
myConfig = def
{ borderWidth = myBorderWidth
, clickJustFocuses = myClickJustFocuses
, focusFollowsMouse = myFocusFollowsMouse
, normalBorderColor = myNormalBorderColor
, focusedBorderColor = myFocusedBorderColor
, manageHook = myManageHook
, handleEventHook = myHandleEventHook
, layoutHook = myLayoutHook
, logHook = myLogHook
, modMask = myModMask
, mouseBindings = myMouseBindings
, startupHook = myStartupHook
, terminal = command myTerminal
, workspaces = myWorkspaces
}
myMouseBindings = mouseBindings def
myStartupHook = startupHook def
----------------------------------------------------------------------------}}}
-- theme {{{
-------------------------------------------------------------------------------
myClickJustFocuses = True
myFocusFollowsMouse = False
-- colors
base03 = "#002b37"
base02 = "#073642"
base01 = "#586e75"
base00 = "#657b83"
base0 = "#839496"
base1 = "#93a1a1"
base2 = "#eee8d5"
base3 = "#fdf6e3"
yellow = "#b58900"
orange = "#cb4b16"
red = "#dc322f"
magenta = "#d33682"
violet = "#6c71c4"
blue = "#268bd2"
cyan = "#2aa198"
green = "#859900"
black = "#000000"
white = "#ffffff"
cActive = blue
cActiveWarn = red
cInactive = base02
cFocus = blue
cUnfocus = base02
-- sizes
sGap = 10
sTopbar = 10
sBorder = 0
sPrompt = 26
sStatus = 20
myBorderWidth = 0
myNormalBorderColor = black
myFocusedBorderColor = cActive
myFont = "-*-terminus-medium-*-*-*-*-160-*-*-*-*-*-*"
tTopBar = def
{ fontName = myFont
, inactiveBorderColor = base03
, inactiveColor = base03
, inactiveTextColor = base03
, activeBorderColor = cActive
, activeTextColor = cActive
, activeColor = cActive
, urgentBorderColor = red
, urgentTextColor = yellow
, decoHeight = sTopbar
}
tPrompt = def
{ font = myFont
, bgColor = base03
, fgColor = cActive
, fgHLight = base03
, bgHLight = cActive
, borderColor = base03
, promptBorderWidth = 0
, height = sPrompt
, position = Top
}
tHotPrompt = tPrompt
{ bgColor = yellow
, fgColor = base03
}
tShowWName = def
{ swn_fade = 0.5
, swn_bgcolor = black
, swn_color = white
}
tTab = def
{ fontName = myFont
, activeColor = cActive
, inactiveColor = base02
, activeBorderColor = cActive
, inactiveBorderColor = base02
, activeTextColor = base03
, inactiveTextColor = base00
}
----------------------------------------------------------------------------}}}
-- Workspaces {{{
-------------------------------------------------------------------------------
wsTERM = "TERM"
wsWEB = "WEB"
wsCOM = "COM"
wsWORKTERM = "WRK:TERM"
wsWORKWEB = "WRK:WEB"
wsMEDIA = "MEDIA"
wsMONITOR = "MONITOR"
wsSYSTEM = "SYSTEM"
wsTEMP = "TEMP"
wsNSP = "NSP"
myWorkspaces = [ wsTERM, wsWEB, wsCOM, wsWORKTERM, wsWORKWEB, wsMEDIA, wsMONITOR, wsSYSTEM, wsTEMP, wsNSP ]
projects :: [Project]
projects =
[ Project { projectName = wsTERM
, projectDirectory = "~/"
, projectStartHook = Just $ spawnOn wsTERM (command myTerminal)
}
, Project { projectName = wsWEB
, projectDirectory = "~/"
, projectStartHook = Just $ spawnOn wsWEB (command myBrowser)
}
, Project { projectName = wsWORKTERM
, projectDirectory = "~/"
, projectStartHook = Just $ spawnOn wsWORKTERM (command myTerminal)
}
, Project { projectName = wsMONITOR
, projectDirectory = "~/"
, projectStartHook = Just $ spawnOn wsMONITOR (command glances)
}
]
----------------------------------------------------------------------------}}}
-- Bindings {{{
-------------------------------------------------------------------------------
myModMask = mod4Mask
myKeys config =
-- You can get the key code using `xev`
---------------------------------------------------------------------------
-- | Actions
---------------------------------------------------------------------------
keySet "Actions"
[
]
^++^
---------------------------------------------------------------------------
-- | Audio
---------------------------------------------------------------------------
keySet "Audio"
[ key "Play" "<XF86AudioPlay>" $ spawn "playerctl play-pause"
, key "Previous" "<XF86AudioPrev>" $ spawn "playerctl previous"
, key "Next" "<XF86AudioNext>" $ spawn "playerctl next"
, key "Mute" "<XF86AudioMute>" $ spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle"
, key "Raise Volume" "<XF86AudioRaiseVolume>" $ spawn "pactl set-sink-volume @DEFAULT_SINK@ +5%"
, key "Lower Volume" "<XF86AudioLowerVolume>" $ spawn "pactl set-sink-volume @DEFAULT_SINK@ -5%"
]
^++^
---------------------------------------------------------------------------
-- | Launchers
---------------------------------------------------------------------------
keySet "Launchers"
[ key "Launcher" "M-<Space>" $ spawn myLauncher
, key "Terminal" "M-<Return>" $ spawnApp myTerminal
, key "Browser" "M-/" $ spawnApp myBrowser
, key "Spotify" "M-=" $ namedScratchpadAction myScratchpads "spotify"
, key "Mixer" "M--" $ namedScratchpadAction myScratchpads "alsamixer"
, key "Console" "M-<Esc>" $ namedScratchpadAction myScratchpads "console"
, key "VLC" "M-x v" $ namedScratchpadAction myScratchpads "vlc"
, key "Slack" "M-s" $ bindOn WS [ (wsWORKTERM, namedScratchpadAction myScratchpads "workSlack")
, (wsWORKWEB, namedScratchpadAction myScratchpads "workSlack")
]
, key "Calendar" "M-c" $ bindOn WS [ (wsWORKTERM, namedScratchpadAction myScratchpads "workCalendar")
, (wsWORKWEB, namedScratchpadAction myScratchpads "workCalendar")
, ("", namedScratchpadAction myScratchpads "personalCalendar")
]
, key "Mail" "M-m" $ bindOn WS [ (wsWORKTERM, namedScratchpadAction myScratchpads "workMail")
, (wsWORKWEB, namedScratchpadAction myScratchpads "workMail")
-- , ("", namedScratchpadAction myScratchpads "personalMail")
]
, key "Trello" "M-t" $ bindOn WS [ (wsWORKTERM, namedScratchpadAction myScratchpads "workTrello")
, (wsWORKWEB, namedScratchpadAction myScratchpads "workTrello")
, ("", namedScratchpadAction myScratchpads "personalTrello")
]
]
^++^
---------------------------------------------------------------------------
-- | Layouts
---------------------------------------------------------------------------
keySet "Layouts"
[ key "Cycle all layouts" "M-<Tab>" $ sendMessage NextLayout
, key "Cycle sublayout" "M-C-<Tab>" $ toSubl NextLayout
-- , key "Reset layout" "M-S-<Tab>" $ setLayout $ XMonad.layoutHook conf
, key "Float tiled window" "M-y" $ withFocused toggleFloat
, key "Tile all floating windows" "M-S-y" $ sinkAll
, key "Fullscreen" "M-f" $ sendMessage $ XMonad.Layout.MultiToggle.Toggle FULL
, key "Decrease master windows" "M-," $ sendMessage $ IncMasterN (-1)
, key "Increase master windows" "M-." $ sendMessage $ IncMasterN 1
, key "Reflect/Rotate" "M-r" $ tryMessageR Rotate (XMonad.Layout.MultiToggle.Toggle REFLECTX)
]
^++^
---------------------------------------------------------------------------
-- | Resizing
---------------------------------------------------------------------------
keySet "Resizing"
[ key "Expand (L on BSP)" "M-[" $ tryMessageR (ExpandTowards L) Shrink
, key "Expand (R on BSP)" "M-]" $ tryMessageR (ExpandTowards R) Expand
, key "Expand (U on BSP)" "M-S-[" $ tryMessageR (ExpandTowards U) MirrorShrink
, key "Expand (D on BSP)" "M-S-]" $ tryMessageR (ExpandTowards D) MirrorExpand
, key "Shrink (L on BSP)" "M-C-[" $ tryMessageR (ShrinkFrom R) Shrink
, key "Shrink (R on BSP)" "M-C-]" $ tryMessageR (ShrinkFrom L) Expand
, key "Shrink (U on BSP)" "M-C-S-[" $ tryMessageR (ShrinkFrom D) MirrorShrink
, key "Shrink (D on BSP)" "M-C-S-]" $ tryMessageR (ShrinkFrom U) MirrorExpand
]
^++^
---------------------------------------------------------------------------
-- | System
---------------------------------------------------------------------------
keySet "System"
[ key "Restart XMonad" "M-q" $ spawn "xmonad --restart"
, key "Rebuild & Restart XMonad" "M-C-q" $ spawn "xmonad --recompile && xmonad --restart"
, key "Lock Screen" "M-`" $ spawn "sleep 1; xset s activate"
]
^++^
---------------------------------------------------------------------------
-- | Workspaces and Projects
---------------------------------------------------------------------------
keySet "Workspaces & Projects" (
[ key "Previous Non-Empty Workspace" "M-S-," $ prevNonEmptyWS
, key "Next Non-Empty Workspace" "M-S-." $ nextNonEmptyWS
]
++ keys "View Workspace" "M-" wsKeys (withNthWorkspace W.greedyView) [0..]
++ keys "Move window to Workspace" "M-C-" wsKeys (withNthWorkspace W.shift) [0..]
)
^++^
---------------------------------------------------------------------------
-- | Screens
---------------------------------------------------------------------------
keySet "Screens" (
[]
++ keys "Navigate Screens" "M-" arrowKeys (flip screenGo True) dirs
++ keys "Move Window to Screen" "M-C-" arrowKeys (flip windowToScreen True) dirs
++ keys "Swap Workspace to Screen" "M-S-C-" arrowKeys (flip screenSwap True) dirs
)
^++^
---------------------------------------------------------------------------
-- | Windows
---------------------------------------------------------------------------
keySet "Windows" (
[ key "Kill" "M-<Backspace>" $ kill
, key "Kill All" "M-S-<Backspace" $ confirmPrompt tHotPrompt "kill all" $ killAll
, key "Promote" "M-b" $ promote
, key "Switch to window" "M-w" $ spawn "rofi -show window"
, key "Un-merge from Sublayout" "M-g" $ withFocused (sendMessage . UnMerge)
, key "Merge all into Sublayout" "M-S-g" $ withFocused (sendMessage . MergeAll)
, key "Focus Master" "M-z m" $ windows W.focusMaster
-- , ("M-z u" , addName "Focus urgent" $ focusUrgent)
, key "Navigate Tabs Down" "M-'" $ bindOn LD [("Tabs", windows W.focusDown), ("", onGroup W.focusDown')]
, key "Navigate Tabs Up" "M-;" $ bindOn LD [("Tabs", windows W.focusUp), ("", onGroup W.focusUp')]
, key "Swap Tab Down" "M-C-'" $ windows W.swapDown
, key "Swap Tab Up" "M-C-;" $ windows W.swapUp
]
++ keys "Navigate Window" "M-" dirKeys (flip windowGo True) dirs
++ keys "Move Window" "M-C-" dirKeys (flip windowSwap True) dirs
++ keys "Merge with Sublayout" "M-S-" dirKeys (sendMessage . pullGroup) dirs
)
where
keySet s ks = subtitle s : mkNamedKeymap config ks
key n k a = (k, addName n a)
keys n m ks a args = zipWith (\k arg -> key n (m ++ k) (a arg)) ks args
dirKeys = ["j", "k", "h", "l"]
dirs = [D, U, L, R ]
wsKeys = map show [1..9] -- ++ [0]
arrowKeys = ["<D>", "<U>", "<L>", "<R>"]
withSelection cmd = getSelection >>= spawn . cmd
spawnApp = spawn . command
zipM m nm ks as f = zipWith (\k d -> key nm (m ++ k) (f d)) ks as
toggleFloat w = windows $ \s ->
if M.member w (W.floating s)
then W.sink w s
else W.float w (W.RationalRect (1/5) (1/5) (3/5) (7/10)) s
tryMessageR x y = sequence_ [tryMessage_ x y, refresh]
nextNonEmptyWS = findWorkspace getSortByIndexNoSP Next HiddenNonEmptyWS 1
>>= \t -> (windows . W.view $ t)
prevNonEmptyWS = findWorkspace getSortByIndexNoSP Prev HiddenNonEmptyWS 1
>>= \t -> (windows . W.view $ t)
getSortByIndexNoSP =
fmap (.namedScratchpadFilterOutWorkspace) getSortByIndex
showKeybindings :: [((KeyMask, KeySym), NamedAction)] -> NamedAction
showKeybindings x = addName "Show Keybindings" $ io $ do
h <- spawnPipe "zenity --text-info --font=terminus"
hPutStr h (unlines $ showKm x)
hClose h
return ()
----------------------------------------------------------------------------}}}
-- Applications {{{
-------------------------------------------------------------------------------
data App
= ClassApp String String
| ResourceApp String String
command :: App -> String
command (ClassApp c _) = c
command (ResourceApp c _) = c
isInstance :: App -> Query Bool
isInstance (ClassApp _ c) = className =? c
isInstance (ResourceApp _ r) = resource =? r
myBrowser = ClassApp "browser" "chromium-browser"
myTerminal = ClassApp "kitty" "kitty"
spotify = ClassApp "spotify" "Spotify"
alsamixer = ClassApp "kitty --class alsamixer --title alsamixer alsamixer" "alsamixer"
vlc = ResourceApp "vlc" "vlc"
workSlack = ResourceApp "dex $HOME/.local/share/applications/WorkSlack.desktop" "crx_nfjipldfidfkljfhmnjigbhfljfpemba"
workCalendar = ResourceApp "dex $HOME/.local/share/applications/WorkCalendar.desktop" "crx_kjbdgfilnfhdoflbpgamdcdgpehopbep"
workMail = ResourceApp "dex $HOME/.local/share/applications/WorkMail.desktop" "crx_kmhopmchchfpfdcdjodmpfaaphdclmlj"
workTrello = ResourceApp "dex $HOME/.local/share/applications/WorkTrello.desktop" "crx_mpdjpnmmnkoappfachmpbalmgmdnmgij"
personalCalendar = ResourceApp "dex $HOME/.local/share/applications/PersonalCalendar.desktop" "crx_cekbafhmingmmacionoegcmednbmapkh"
-- personalMail = ResourceApp "dex $HOME/.local/share/applications/PersonalMail.desktop" "crx_kmhopmchchfpfdcdjodmpfaaphdclmlj"
personalTrello = ResourceApp "dex $HOME/.local/share/applications/PersonalTrello.desktop" "crx_pkheepclhaffooboabnelkgnboncfbbf"
console = ClassApp "kitty --class console --title console" "console"
glances = ClassApp "kitty --class glances --title glances glances" "glances"
myLauncher = "rofi -matching fuzzy -modi combi -show combi -combi-modi run,drun"
myScratchpads =
[ scratchpadApp "spotify" spotify defaultFloating
, scratchpadApp "alsamixer" alsamixer (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3))
, scratchpadApp "vlc" vlc defaultFloating
, scratchpadApp "console" console (customFloating $ W.RationalRect 0 0 1 (1/2))
, scratchpadApp "workSlack" workSlack defaultFloating
, scratchpadApp "workCalendar" workCalendar defaultFloating
, scratchpadApp "workMail" workMail defaultFloating
, scratchpadApp "workTrello" workTrello defaultFloating
, scratchpadApp "personalCalendar" personalCalendar defaultFloating
-- , scratchpadApp "personalMail" personalMail defaultFloating
, scratchpadApp "personalTrello" personalTrello defaultFloating
] where
scratchpadApp :: String -> App -> Query (Endo WindowSet) -> NamedScratchpad
scratchpadApp n a f = NS n (command a) (isInstance a) f
----------------------------------------------------------------------------}}}
-- Navigation {{{
-------------------------------------------------------------------------------
myNav2DConfig = def
{ defaultTiledNavigation = centerNavigation
, floatNavigation = centerNavigation
, screenNavigation = lineNavigation
, layoutNavigation = [("Full", centerNavigation)]
, unmappedWindowRect = [("Full", singleWindowRect)]
}
----------------------------------------------------------------------------}}}
-- Layouts {{{
-------------------------------------------------------------------------------
myLayoutHook = showWorkspaceName
$ fullscreenFloat
$ fullScreenToggle
$ mirrorToggle
$ reflectToggle
$ flex ||| tabs
where
showWorkspaceName = showWName' tShowWName
fullScreenToggle = mkToggle (single FULL)
mirrorToggle = mkToggle (single MIRROR)
reflectToggle = mkToggle (single REFLECTX)
-- Flex Layout
flex = trimNamed 5 "Flex"
$ avoidStruts
$ windowNavigation
$ addTopBar
$ addTabs shrinkText tTab
$ subLayout [] (Simplest ||| Accordion)
$ ifWider smallMonitorWidth wideLayouts standardLayouts
smallMonitorWidth = 1920
wideLayouts = myGaps
$ mySpacing
$ (suffixed "Wide 3 Column" $ ThreeColMid 1 (1/20) (1/2))
||| (trimSuffixed 1 "Wide BSP" $ hiddenWindows emptyBSP)
standardLayouts = myGaps
$ mySpacing
$ (suffixed "Standard 2/3" $ ResizableTall 1 (1/20) (2/3) [])
||| (suffixed "Standard 1/2" $ ResizableTall 1 (1/20) (1/2) [])
||| (trimSuffixed 1 "Standard BSP" $ hiddenWindows emptyBSP)
-- Tabs Layout
tabs = named "Tabs"
$ avoidStruts
$ addTopBar
$ addTabs shrinkText tTab
$ Simplest
named n = renamed [(XMonad.Layout.Renamed.Replace n)]
trimNamed w n = renamed [(XMonad.Layout.Renamed.CutWordsLeft w),
(XMonad.Layout.Renamed.PrependWords n)]
suffixed n = renamed [(XMonad.Layout.Renamed.AppendWords n)]
trimSuffixed w n = renamed [(XMonad.Layout.Renamed.CutWordsRight w),
(XMonad.Layout.Renamed.AppendWords n)]
addTopBar = noFrillsDeco shrinkText tTopBar
myGaps = gaps [(U, sGap), (D, sGap), (L, sGap), (R, sGap)]
mySpacing = spacing sGap
----------------------------------------------------------------------------}}}
-- LogHook {{{
-------------------------------------------------------------------------------
myLogHook =
fadeWindowsLogHook myFadeHook
myFadeHook = composeAll
[ opaque
, isUnfocused --> opacity 0.85
, isInstance myTerminal <&&> isUnfocused --> opacity 0.9
, (isInstance workSlack <||> isInstance workCalendar <||> isInstance workMail <||> isInstance workTrello) <&&> isUnfocused --> opaque
, (isInstance personalCalendar <||> isInstance personalTrello) <&&> isUnfocused --> opaque
, isInstance console --> opacity 0.9
, isDialog --> opaque
]
----------------------------------------------------------------------------}}}
-- ManageHook }}}
-------------------------------------------------------------------------------
myManageHook :: ManageHook
myManageHook =
manageApps
<+> manageScratchpads
<+> manageSpawn
where
manageApps = composeOne
-- Applications
[ isInstance vlc -?> doFloat
, isInstance spotify -?> doFloat
-- Dialogs
, isBrowserDialog -?> forceCenterFloat
, isFileChooserDialog -?> forceCenterFloat
, isDialog -?> doCenterFloat
, isPopup -?> doCenterFloat
, isSplash -?> doCenterFloat
-- Other
, transience
, isFullscreen -?> doFullFloat
, pure True -?> tileBelow
]
isBrowserDialog = isDialog <&&> isInstance myBrowser
isFileChooserDialog = isRole =? "GtkFileChooserDialog"
isPopup = isRole =? "pop-up"
isSplash = isInProperty "_NET_WM_WINDOW_TYPE" "_NET_WM_WINDOW_TYPE_SPLASH"
isRole = stringProperty "WM_WINDOW_ROLE"
tileBelow = insertPosition Below Newer
manageScratchpads = namedScratchpadManageHook myScratchpads
forceCenterFloat = doFloatDep move
where
move :: W.RationalRect -> W.RationalRect
move _ = W.RationalRect x y w h
w, h, x, y :: Rational
w = 1/3
h = 1/2
x = (1-w)/2
y = (1-h)/2
----------------------------------------------------------------------------}}}
-- HandleEventHook {{{
-------------------------------------------------------------------------------
myHandleEventHook =
fadeWindowsEventHook
<+> handleEventHook def
<+> XMonad.Layout.Fullscreen.fullscreenEventHook
----------------------------------------------------------------------------}}}