-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmonad.hs
579 lines (520 loc) · 26.9 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
-- Base
import XMonad
import System.IO (hPutStrLn)
import System.Exit (exitSuccess)
import qualified XMonad.StackSet as W
-- Actions
import XMonad.Actions.CopyWindow (kill1, killAllOtherCopies)
import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen, nextWS, prevWS)
import XMonad.Actions.GridSelect
import XMonad.Actions.MouseResize
import XMonad.Actions.Promote
import XMonad.Actions.RotSlaves (rotSlavesDown, rotAllDown)
import qualified XMonad.Actions.TreeSelect as TS
import XMonad.Actions.WindowGo (runOrRaise)
import XMonad.Actions.WithAll (sinkAll, killAll)
import qualified XMonad.Actions.Search as S
-- Data
import Data.Char (isSpace, toUpper)
import Data.Monoid
import Data.Maybe (isJust)
import Data.Tree
import qualified Data.Map as M
-- Hooks
import XMonad.Hooks.DynamicLog (dynamicLogWithPP, wrap, xmobarPP, xmobarColor, shorten, PP(..))
import XMonad.Hooks.EwmhDesktops -- for some fullscreen events, also for xcomposite in obs.
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.ManageDocks (avoidStruts, docks, manageDocks, ToggleStruts(..))
import XMonad.Hooks.ManageHelpers (isFullscreen, doFullFloat, doCenterFloat)
import XMonad.Hooks.ServerMode
import XMonad.Hooks.SetWMName
import XMonad.Hooks.StatusBar
import XMonad.Hooks.StatusBar.PP
import XMonad.Hooks.WorkspaceHistory
-- Layouts
import XMonad.Layout.Accordion
import XMonad.Layout.GridVariants (Grid(Grid))
import XMonad.Layout.SimplestFloat
import XMonad.Layout.Spiral
import XMonad.Layout.ResizableTile
import XMonad.Layout.Tabbed
-- Layouts modifiers
import XMonad.Layout.LayoutModifier
import XMonad.Layout.LimitWindows (limitWindows, increaseLimit, decreaseLimit)
import XMonad.Layout.Magnifier
import XMonad.Layout.MultiToggle (mkToggle, single, EOT(EOT), (??))
import XMonad.Layout.MultiToggle.Instances (StdTransformers(NBFULL, MIRROR, NOBORDERS))
import XMonad.Layout.NoBorders
import XMonad.Layout.Renamed
import XMonad.Layout.ShowWName
import XMonad.Layout.Simplest
import XMonad.Layout.Spacing
import XMonad.Layout.SubLayouts
import XMonad.Layout.WindowNavigation
import XMonad.Layout.WindowArranger (windowArrange, WindowArrangerMsg(..))
import qualified XMonad.Layout.ToggleLayouts as T (toggleLayouts, ToggleLayout(Toggle))
import qualified XMonad.Layout.MultiToggle as MT (Toggle(..))
-- Prompt
import XMonad.Prompt
import XMonad.Prompt.Input
import XMonad.Prompt.FuzzyMatch
import XMonad.Prompt.Man
import XMonad.Prompt.Pass
import XMonad.Prompt.Shell
import XMonad.Prompt.Ssh
import XMonad.Prompt.XMonad
import Control.Arrow (first)
-- Utilities
import XMonad.Util.EZConfig (additionalKeysP)
import XMonad.Util.Hacks (windowedFullscreenFixEventHook, trayerAboveXmobarEventHook, trayAbovePanelEventHook, trayerPaddingXmobarEventHook, trayPaddingXmobarEventHook, trayPaddingEventHook)
import XMonad.Util.NamedScratchpad
import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
import XMonad.Util.SpawnOnce
------------------------------------------------------------------------
-- VARIABLES
------------------------------------------------------------------------
-- It's nice to assign values to stuff that you will use more than once
-- in the config. Setting values for things like font, terminal and editor
-- means you only have to change the value here to make changes globally.
myFont :: String
myFont = "xft:Mononoki Nerd Font:bold:size=10:antialias=true:hinting=true"
myModMask :: KeyMask
myModMask = mod4Mask -- Sets modkey to super/windows key
myTerminal :: String
myTerminal = "kitty" -- Sets default terminal
myBrowser :: String
myBrowser = "firefox " -- Sets firefox as browser
myEditor :: String
myEditor = myTerminal ++ " -e nvim " -- Sets nvim as editor
myBorderWidth :: Dimension
myBorderWidth = 0 -- Sets border width for windows
myNormColor :: String
myNormColor = "#282c34" -- Border color of normal windows
myFocusColor :: String
myFocusColor = "#bd93f9" -- Border color of focused windows
altMask :: KeyMask
altMask = mod1Mask -- Setting this for use in xprompts
------------------------------------------------------------------------
-- AUTOSTART
------------------------------------------------------------------------
myStartupHook :: X ()
myStartupHook = do
spawnOnce "clipmenud &"
spawnOnce "ferdium &"
------------------------------------------------------------------------
-- XPROMPT SETTINGS
------------------------------------------------------------------------
xpConfig :: XPConfig
xpConfig = def
{ font = myFont
, bgColor = "#282c34"
, fgColor = "#bbc2cf"
, bgHLight = "#c792ea"
, fgHLight = "#000000"
, borderColor = "#535974"
, promptBorderWidth = 0
, promptKeymap = xpKeymap
, position = Top
-- , position = CenteredAt { xpCenterY = 0.3, xpWidth = 0.3 }
, height = 20
, historySize = 256
, historyFilter = id
, defaultText = []
, autoComplete = Just 100000 -- set Just 100000 for .1 sec
, showCompletionOnTab = False
-- , searchPredicate = isPrefixOf
, searchPredicate = fuzzyMatch
, defaultPrompter = id $ map toUpper -- change prompt to UPPER
-- , defaultPrompter = unwords . map reverse . words -- reverse the prompt
-- , defaultPrompter = drop 5 .id (++ "XXXX: ") -- drop first 5 chars of prompt and add XXXX:
, alwaysHighlight = True
, maxComplRows = Nothing -- set to 'Just 5' for 5 rows
}
-- The same config above minus the autocomplete feature which is annoying
-- on certain Xprompts, like the search engine prompts.
xpConfig' :: XPConfig
xpConfig' = xpConfig
{ autoComplete = Nothing
}
-- A list of all of the standard Xmonad prompts and a key press assigned to them.
-- These are used in conjunction with keybinding I set later in the config.
promptList :: [(String, XPConfig -> X ())]
promptList = [ ("m", manPrompt) -- manpages prompt
, ("p", passPrompt) -- get passwords (requires 'pass')
, ("g", passGeneratePrompt) -- generate passwords (requires 'pass')
, ("r", passRemovePrompt) -- remove passwords (requires 'pass')
, ("s", sshPrompt) -- ssh prompt
, ("x", xmonadPrompt) -- xmonad prompt
]
systemPromptCmds = [
("Shutdown", spawn (myTerminal ++ " -e poweroff")),
("Reboot", spawn (myTerminal ++ " -e reboot")),
("Log out", io exitSuccess)
]
codePromptCmds = [
("Xmonad", spawn (myTerminal ++ " -e nvim ~/.xmonad/xmonad.hs")),
("fish", spawn (myTerminal ++ " -e nvim ~/.config/fish/config.fish")),
("bash", spawn (myTerminal ++ " -e nvim ~/.bashrc"))
]
keyboardPromptCmds = [
("ES", spawn ("setxkbmap -layout es")),
("US", spawn ("setxkbmap -layout us -variant altgr-intl -option nodeadkeys"))
]
screenshotPromptCmds = [
("Select/Clipboard", spawn ("maim -s --hidecursor | xclip -selection clipboard -t image/png && notify-send 'image saved to clipboard'")),
("Select/Folder", spawn ("maim -s --hidecursor | xclip -selection clipboard -t image/png; xclip -selection clipboard -t image/png -o > ~/Documents/Nextcloud/photos/screenshots/$(date +%F-%H:%M:%S).png && notify-send 'image saved to screenshots'")),
("Focus/Clipboard", spawn ("maim -i $(xdotool getactivewindow) --hidecursor | xclip -selection clipboard -t image/png && notify-send 'image saved to clipboard'")),
("Focus/Folder", spawn ("maim -i $(xdotool getactivewindow) ~/Documents/Nextcloud/photos/screenshots/$(date +%F-%H:%M:%S).png --hidecursor | xclip -selection clipboard -t image/png && notify-send 'image saved to screenshots'")),
("Focus/Folder/Cursor", spawn ("maim -i $(xdotool getactivewindow) ~/Documents/Nextcloud/photos/screenshots/$(date +%F-%H:%M:%S).png | xclip -selection clipboard -t image/png && notify-send 'image saved to screenshots'")),
("Fullscreen/Clipboard", spawn ("maim --hidecursor | xclip -selection clipboard -t image/png && notify-send 'image saved to clipboard'")),
("Fullscreen/Folder", spawn ("maim ~/Documents/Nextcloud/photos/screenshots/$(date +%F-%H:%M:%S).png --hidecursor | xclip -selection clipboard -t image/png && notify-send 'image saved to screenshots'")),
("RGB", spawn ("maim -st 0 | convert - -resize 1x1! -format '%[pixel:p{0,0}]' info:- | xclip -sel clip && notify-send 'RGB saved to clipboard'"))
]
------------------------------------------------------------------------
-- XPROMPT KEYMAP (emacs-like key bindings for xprompts)
------------------------------------------------------------------------
xpKeymap :: M.Map (KeyMask,KeySym) (XP ())
xpKeymap = M.fromList $
map (first $ (,) controlMask) -- control + <key>
[ (xK_z, killBefore) -- kill line backwards
, (xK_k, killAfter) -- kill line forwards
, (xK_a, startOfLine) -- move to the beginning of the line
, (xK_e, endOfLine) -- move to the end of the line
, (xK_m, deleteString Next) -- delete a character foward
, (xK_b, moveCursor Prev) -- move cursor forward
, (xK_f, moveCursor Next) -- move cursor backward
, (xK_BackSpace, killWord Prev) -- kill the previous word
, (xK_y, pasteString) -- paste a string
, (xK_g, quit) -- quit out of prompt
, (xK_bracketleft, quit)
]
++
map (first $ (,) altMask) -- meta key + <key>
[ (xK_BackSpace, killWord Prev) -- kill the prev word
, (xK_f, moveWord Next) -- move a word forward
, (xK_b, moveWord Prev) -- move a word backward
, (xK_d, killWord Next) -- kill the next word
, (xK_n, moveHistory W.focusUp') -- move up thru history
, (xK_p, moveHistory W.focusDown') -- move down thru history
]
++
map (first $ (,) 0) -- <key>
[ (xK_Return, setSuccess True >> setDone True)
, (xK_KP_Enter, setSuccess True >> setDone True)
, (xK_BackSpace, deleteString Prev)
, (xK_Delete, deleteString Next)
, (xK_Left, moveCursor Prev)
, (xK_Right, moveCursor Next)
, (xK_Home, startOfLine)
, (xK_End, endOfLine)
, (xK_Down, moveHistory W.focusUp')
, (xK_Up, moveHistory W.focusDown')
, (xK_Escape, quit)
]
------------------------------------------------------------------------
-- SEARCH ENGINES
------------------------------------------------------------------------
-- Xmonad has several search engines available to use located in
-- XMonad.Actions.Search. Additionally, you can add other search engines
-- such as those listed below.
archwiki, ebay, news, reddit, urban :: S.SearchEngine
archwiki = S.searchEngine "archwiki" "https://wiki.archlinux.org/index.php?search="
ebay = S.searchEngine "ebay" "https://www.ebay.com/sch/i.html?_nkw="
news = S.searchEngine "news" "https://news.google.com/search?q="
reddit = S.searchEngine "reddit" "https://www.reddit.com/search/?q="
urban = S.searchEngine "urban" "https://www.urbandictionary.com/define.php?term="
startpage = S.searchEngine "startpage" "https://www.startpage.com/do/dsearch?query="
-- This is the list of search engines that I want to use. Some are from
-- XMonad.Actions.Search, and some are the ones that I added above.
searchList :: [(String, S.SearchEngine)]
searchList = [ ("a", archwiki)
, ("d", S.duckduckgo)
, ("e", ebay)
, ("g", S.google)
, ("i", S.images)
, ("n", news)
, ("r", reddit)
, ("s", startpage)
, ("u", urban)
, ("w", S.wikipedia)
, ("y", S.youtube)
, ("z", S.amazon)
]
------------------------------------------------------------------------
-- SCRATCHPADS
------------------------------------------------------------------------
-- Allows to have several floating scratchpads running different applications.
-- Import Util.NamedScratchpad. Bind a key to namedScratchpadSpawnAction.
myScratchPads :: [NamedScratchpad]
myScratchPads = [ NS "thunderbird" spawnThunderbird findThunderbird manageThunderbird
, NS "cmus" spawnCmus findCmus manageCmus
]
where
spawnThunderbird = "thunderbird"
findThunderbird = className =? "thunderbird"
manageThunderbird = customFloating $ W.RationalRect l t w h
where
h = 0.9
w = 0.9
t = 0.95 -h
l = 0.95 -w
spawnCmus = myTerminal ++ " --name cmus -e cmus"
findCmus = appName =? "cmus"
manageCmus = customFloating $ W.RationalRect l t w h
where
h = 0.9
w = 0.9
t = 0.95 -h
l = 0.95 -w
------------------------------------------------------------------------
-- LAYOUTS
------------------------------------------------------------------------
-- Makes setting the spacingRaw simpler to write. The spacingRaw
-- module adds a configurable amount of space around windows.
mySpacing :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
mySpacing i = spacingRaw False (Border i i i i) True (Border i i i i) True
-- Below is a variation of the above except no borders are applied
-- if fewer than two windows. So a single window has no gaps.
mySpacing' :: Integer -> l a -> XMonad.Layout.LayoutModifier.ModifiedLayout Spacing l a
mySpacing' i = spacingRaw True (Border i i i i) True (Border i i i i) True
-- Defining a bunch of layouts, many that I don't use.
tall = renamed [Replace "tall"]
$ windowNavigation
$ addTabs shrinkText myTabTheme
$ subLayout [] (smartBorders Simplest)
$ limitWindows 12
$ mySpacing' 8
$ ResizableTall 1 (3/100) (1/2) []
floats = renamed [Replace "floats"]
$ smartBorders
$ simplestFloat
tabs = renamed [Replace "tabs"]
-- I cannot add spacing to this layout because it will
-- add spacing between window and tabs which looks bad.
$ tabbed shrinkText myTabTheme
myTabTheme = def { fontName = myFont
, activeColor = "#c792ea"
, inactiveColor = "#313846"
, activeBorderColor = "#c792ea"
, inactiveBorderColor = "#282c34"
, activeTextColor = "#282c34"
, inactiveTextColor = "#d0d0d0"
}
-- The layout hook
myLayoutHook = avoidStruts
$ mouseResize
$ windowArrange
$ T.toggleLayouts floats
$ mkToggle (NBFULL ?? NOBORDERS ?? EOT) myDefaultLayout
where
myDefaultLayout = smartBorders tall
||| floats
||| noBorders tabs
------------------------------------------------------------------------
-- WORKSPACES
------------------------------------------------------------------------
-- My workspaces are clickable meaning that the mouse can be used to switch
-- workspaces. This requires xdotool. You need to use UnsafeStdInReader instead
-- of simply StdInReader in xmobar config so you can pass actions to it.
xmobarEscape :: String -> String
xmobarEscape = concatMap doubleLts
where
doubleLts '<' = "<<"
doubleLts x = [x]
myWorkspaces :: [String]
myWorkspaces = clickable . map xmobarEscape
$ [" 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 "]
where
clickable l = [ "<action=xdotool key super+" ++ show n ++ ">" ++ ws ++ "</action>" |
(i,ws) <- zip [1..9] l,
let n = i ]
------------------------------------------------------------------------
-- MANAGEHOOK
------------------------------------------------------------------------
-- Sets some rules for certain programs. Examples include forcing certain
-- programs to always float, or to always appear on a certain workspace.
-- Forcing programs to a certain workspace with a doShift requires xdotool
-- if you are using clickable workspaces. You need the className or title
-- of the program. Use xprop to get this info.
myManageHook :: XMonad.Query (Data.Monoid.Endo WindowSet)
myManageHook = composeAll
-- using 'doShift ( myWorkspaces !! 7)' sends program to workspace 8!
-- I'm doing it this way because otherwise I would have to write out the full
-- name of my workspaces, and the names would very long if using clickable workspaces.
[ className =? "Lutris" --> doShift (myWorkspaces !! 4),
className =? "steam" --> doShift (myWorkspaces !! 5),
className =? "discord" --> doShift (myWorkspaces !! 2),
className =? "Ferdium" --> doShift (myWorkspaces !! 2),
title =? "zenity" --> doFloat,
className =? "confirm" --> doFloat,
className =? "dialog" --> doFloat,
className =? "download" --> doFloat,
className =? "error" --> doFloat,
className =? "file_progress" --> doFloat,
className =? "notification" --> doFloat,
className =? "splash" --> doFloat,
className =? "Navigator" --> doFloat,
className =? "toolbar" --> doFloat,
className =? "confirmreset" --> doFloat,
className =? "Windscribe2" --> doCenterFloat,
className =? "Pavucontrol" --> doCenterFloat,
className =? "Bsvc.tk" --> doCenterFloat,
(className =? "firefox" <&&> resource =? "Dialog") --> doCenterFloat -- Float Firefox Dialog
] <+> namedScratchpadManageHook myScratchPads
------------------------------------------------------------------------
-- LOGHOOK
------------------------------------------------------------------------
-- Sets opacity for inactive (unfocused) windows. I prefer to not use
-- this feature so I've set opacity to 1.0. If you want opacity, set
-- this to a value of less than 1 (such as 0.9 for 90% opacity).
myLogHook :: X ()
myLogHook = fadeInactiveLogHook fadeAmount
where fadeAmount = 1
------------------------------------------------------------------------
-- KEYBINDINGS
------------------------------------------------------------------------
-- I am using the Xmonad.Util.EZConfig module which allows keybindings
-- to be written in simpler, emacs-like format.
myKeys :: [(String, X ())]
myKeys =
-- Xmonad
[ ("M-S-r", spawn "xmonad --recompile; xmonad --restart") -- Recompile and restarts xmonad
-- Run Prompt
, ("M-S-<Return>", shellPrompt xpConfig) -- Shell Prompt
, ("M-0", xmonadPromptC systemPromptCmds xpConfig) -- Prompt for log out, shutoff and restart
, ("M-S-c", xmonadPromptC codePromptCmds xpConfig) -- Prompt for editing dotfiles
, ("M-S-l", xmonadPromptC keyboardPromptCmds xpConfig) -- Prompt for editing dotfiles
, ("M-S-p", xmonadPromptC screenshotPromptCmds xpConfig) -- Prompt for screenshot options
-- Useful programs to have a keybinding for launch
, ("M-<Return>", spawn (myTerminal ++ " -e fish")) -- Runs default terminal with fish
, ("M-v", spawn (myBrowser))
, ("M-S-v", spawn ("pcmanfm"))
, ("M-S-x", spawn ("xkill"))
, ("M-S-b", spawn "xdotool sleep 1 type '$(xclip -o -sel clip)'")
, ("M1-C-h", spawn "clipmenu -i -fn 'Mononoki Nerd Font Mono-11' -nb '#282a36' -nf '#f8f8f2' -sb '#bd93f9' -sf '#44475a'")
-- Kill windows
, ("M-S-q", kill1) -- Kill the currently focused client
, ("M-S-a", killAll) -- Kill all windows on current workspace
-- Workspaces
, ("M-.", nextScreen) -- Switch focus to next monitor
, ("M-,", prevScreen) -- Switch focus to prev monitor
, ("M-M1-<Up>", shiftTo Next nonNSP >> moveTo Next nonNSP) -- Shifts focused window to next ws
, ("M-M1-<Down>", shiftTo Prev nonNSP >> moveTo Prev nonNSP) -- Shifts focused window to prev ws
, ("M-n", prevWS)
, ("M-M1-n", nextWS)
-- Floating windows
, ("M-f", sendMessage (T.Toggle "floats")) -- Toggles my 'floats' layout
, ("M-t", withFocused $ windows . W.sink) -- Push floating window back to tile
, ("M-S-t", sinkAll) -- Push ALL floating windows to tile
-- Increase/decrease spacing (gaps)
, ("M-d", decWindowSpacing 4) -- Decrease window spacing
, ("M-i", incWindowSpacing 4) -- Increase window spacing
, ("M-S-d", decScreenSpacing 4) -- Decrease screen spacing
, ("M-S-i", incScreenSpacing 4) -- Increase screen spacing
-- Windows navigation
, ("M-m", windows W.focusMaster) -- Move focus to the master window
, ("M-j", windows W.focusDown) -- Move focus to the next window
, ("M-k", windows W.focusUp) -- Move focus to the prev window
, ("M-S-m", windows W.swapMaster) -- Swap the focused window and the master window
, ("M-S-j", windows W.swapDown) -- Swap focused window with next window
, ("M-S-k", windows W.swapUp) -- Swap focused window with prev window
, ("M-S-<Tab>", rotSlavesDown) -- Rotate all windows except master and keep focus in place
, ("M-C-<Tab>", rotAllDown) -- Rotate all the windows in the current stack
-- Layouts
, ("M-<Tab>", sendMessage NextLayout) -- Switch to next layout
, ("M-<Space>", sendMessage (MT.Toggle NBFULL) >> sendMessage ToggleStruts) -- Toggles noborder/full
, ("M-S-<Space>", sendMessage ToggleStruts) -- Toggles struts
, ("M-S-n", sendMessage $ MT.Toggle NOBORDERS) -- Toggles noborder
-- Increase/decrease windows in the master pane or the stack
, ("M-S-<Up>", sendMessage (IncMasterN 1)) -- Increase number of clients in master pane
, ("M-S-<Down>", sendMessage (IncMasterN (-1))) -- Decrease number of clients in master pane
, ("M-C-<Up>", increaseLimit) -- Increase number of windows
, ("M-C-<Down>", decreaseLimit) -- Decrease number of windows
-- Window resizing
, ("M-h", sendMessage Shrink) -- Shrink horiz window width
, ("M-l", sendMessage Expand) -- Expand horiz window width
, ("M-M1-j", sendMessage MirrorShrink) -- Shrink vert window width
, ("M-M1-k", sendMessage MirrorExpand) -- Expand vert window width
-- Sublayouts
-- This is used to push windows to tabbed sublayouts, or pull them out of it.
, ("M-C-h", sendMessage $ pullGroup L)
, ("M-C-l", sendMessage $ pullGroup R)
, ("M-C-k", sendMessage $ pullGroup U)
, ("M-C-j", sendMessage $ pullGroup D)
, ("M-C-m", withFocused (sendMessage . MergeAll))
, ("M-C-u", withFocused (sendMessage . UnMerge))
, ("M-C-S-u", withFocused (sendMessage . UnMergeAll))
, ("M-C-.", onGroup W.focusUp') -- Switch focus to next tab
, ("M-C-,", onGroup W.focusDown') -- Switch focus to prev tab
-- Scratchpads
, ("M-<F1>", namedScratchpadAction myScratchPads "thunderbird")
, ("M-<F2>", namedScratchpadAction myScratchPads "cmus")
-- Controls for cmus music player (SUPER-u followed by a key)
, ("M-u p", spawn "cmus-remote -u")
, ("M-u l", spawn "cmus-remote -n")
, ("M-u h", spawn "cmus-remote -r")
, ("M-=", spawn ("cmus-remote -v +5%"))
, ("M--", spawn ("cmus-remote -v -5%"))
-- Multimedia Keys
, ("<XF86AudioPlay>", spawn ("cmus-remote -u"))
, ("M4-<F8>", spawn ("cmus-remote -u"))
, ("<XF86AudioPrev>", spawn ("cmus-remote -r"))
, ("M4-<F7>", spawn ("cmus-remote -r"))
, ("<XF86AudioNext>", spawn ("cmus-remote -n"))
, ("M4-<F9>", spawn ("cmus-remote -n"))
, ("<XF86AudioMute>", spawn "volume mute")
, ("<XF86AudioLowerVolume>", spawn "volume down")
, ("<XF86AudioRaiseVolume>", spawn "volume up")
, ("<XF86MonBrightnessUp>", spawn "brightness up")
, ("<XF86MonBrightnessDown>", spawn "brightness down")
-- select and save to clipboard
, ("<Print>", spawn "maim -s --hidecursor | xclip -selection clipboard -t image/png && notify-send 'image saved to clipboard'")
]
-- Appending search engine prompts to keybindings list.
-- Look at "search engines" section of this config for values for "k".
++ [("M-s " ++ k, S.promptSearch xpConfig' f) | (k,f) <- searchList ]
++ [("M-S-s " ++ k, S.selectSearch f) | (k,f) <- searchList ]
-- Appending some extra xprompts to keybindings list.
-- Look at "xprompt settings" section this of config for values for "k".
++ [("M-p " ++ k, f xpConfig') | (k,f) <- promptList ]
-- The following lines are needed for named scratchpads.
where nonNSP = WSIs (return (\ws -> W.tag ws /= "nsp"))
nonEmptyNonNSP = WSIs (return (\ws -> isJust (W.stack ws) && W.tag ws /= "nsp"))
------------------------------------------------------------------------
-- MAIN
------------------------------------------------------------------------
main :: IO ()
main = do
xmproc0 <- spawnPipe "xmobar -x 0 ~/.config/xmobar/xmobarrc0"
xmproc1 <- spawnPipe "xmobar -x 1 ~/.config/xmobar/xmobarrc1"
-- the xmonad, ya know...what the WM is named after!
xmonad $ ewmh $ docks $ def
{ manageHook = ( isFullscreen --> doFullFloat ) <+> myManageHook <+> manageDocks
, handleEventHook = trayerPaddingXmobarEventHook <> trayerAboveXmobarEventHook
, modMask = myModMask
, terminal = myTerminal
, startupHook = myStartupHook
, layoutHook = myLayoutHook
, workspaces = myWorkspaces
, borderWidth = myBorderWidth
, normalBorderColor = myNormColor
, focusedBorderColor = myFocusColor
, logHook = workspaceHistoryHook <+> myLogHook <+> dynamicLogWithPP xmobarPP
{ ppOutput = \x -> hPutStrLn xmproc0 x -- xmobar on monitor 1
>> hPutStrLn xmproc1 x -- xmobar on monitor 2
, ppCurrent = xmobarColor "#98be65" "" . wrap " [" "] " -- Current workspace in xmobar
-- Visible but not current workspace
, ppVisible = xmobarColor "#98be65" "" .wrap "" "*"
-- Hidden workspace
, ppHidden = xmobarColor "#c792ea" "" . wrap "" ""
-- Hidden workspaces (no windows)
, ppHiddenNoWindows = xmobarColor "#82AAFF" ""
-- Title of active window
, ppTitle = xmobarColor "#b3afc2" "" . shorten 60
-- Separator character
, ppSep = "<fc=#666666> <fn=2>|</fn> </fc>"
-- Urgent workspace
, ppUrgent = xmobarColor "#C45500" "" . wrap "!" "!"
}
}
`additionalKeysP` myKeys