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
|
import XMonad
import XMonad.Actions.UpdatePointer
import XMonad.Actions.CycleWS
import XMonad.Actions.DwmPromote
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.StatusBar
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.WindowSwallowing
import XMonad.Layout.ThreeColumns
import XMonad.Layout.Spacing
import XMonad.Layout.NoBorders
import XMonad.Layout.Renamed
import XMonad.Layout.Accordion
import XMonad.Layout.Grid
import XMonad.Util.Cursor
import XMonad.Util.EZConfig
import XMonad.Util.Loggers
import XMonad.Util.Ungrab
import System.Exit (exitSuccess)
main :: IO ()
main = xmonad
. ewmh
. ewmhFullscreen
. withEasySB (statusBarProp "xmobar" (pure myXmobarPP)) defToggleStrutsKey
$ myConfig
myConfig = def
{ modMask = mod4Mask -- Rebind Mod to the Super key
, layoutHook = lessBorders OnlyFloat $ avoidStruts $ myLayout -- layouts
, manageHook = myManageHook -- float/swallow rules
, startupHook = setDefaultCursor xC_left_ptr -- sets the cursor
, handleEventHook = swallowEventHook (className =? "Alacritty") (return True) -- make alacritty swallowable
, workspaces = myWorkspaces -- workspace names
, logHook = updatePointer (0.5, 0.5) (0, 0) -- warp pointer to center of window on focus
, borderWidth = 2
, normalBorderColor = "#3c3836"
, focusedBorderColor = "#928374"
}
`additionalKeysP`
[ -- executables
("M-S-<Escape>", spawn "slock")
, ("M-S-f", spawn "librewolf-bin")
, ("M-S-k", spawn "keepassxc")
, ("M-<F1>", spawn "volmute")
, ("M-<F2>", spawn "voldown")
, ("M-<F3>", spawn "volup")
, ("M-<F7>", spawn "brightness-down")
, ("M-<F8>", spawn "brightness-up")
, ("M-<F11>", spawn "screenshot")
, ("M-p", spawn "dmenu_run_history -fn 'JetBrains Mono NF:style=medium:size=11' -nb '#3c3836' -nf '#ebdbb2' -sb '#504945' -sf '#ebdbb2'")
, ("M-S-<Return>", spawn "spawn-alacritty")
-- XMonad calls
, ("M-<Tab>", toggleWS)
, ("M-<Return>", dwmpromote)
-- layout jumps
, ("M-t", sendMessage $ JumpToLayout "Normal")
-- rebound quit call
, ("M-S-<Backspace>", io exitSuccess)
]
`removeKeysP`
[ -- default quit keybind, as moved to M-S-<Backspace>
("M-S-q")
]
myWorkspaces :: [String]
myWorkspaces = [ "!", "@", "#", "$", "%", "^", "&", "*", "(" ]
myLayout = tiled ||| full ||| threeCol ||| accordion ||| grid
where
tiled = renamed [Replace "Normal"] $ spaced $ Tall nmaster delta ratio
full = renamed [Replace "Full"] $ spaced $ Full
threeCol = renamed [Replace "ThreeCol"] $ spaced $ ThreeColMid nmaster delta ratio
accordion = renamed [Replace "Accrdin"] $ spaced $ Accordion
grid = renamed [Replace "Grid"] $ spaced $ Grid
nmaster = 1 -- Default number of windows in the master pane
ratio = 6/10 -- Default proportion of screen occupied by master pane
delta = 2/100 -- Percent of screen to increment by when resizing panes
spaced = spacing 2
myManageHook :: ManageHook
myManageHook = composeAll
[ className =? "Gimp" --> doFloat
, isDialog --> doFloat
]
myXmobarPP :: PP
myXmobarPP = def
{ ppSep = magenta " • "
, ppTitleSanitize = xmobarStrip
, ppCurrent = wrap "" "" . xmobarBorder "Top" "#8be9fd" 2
, ppUrgent = red . wrap (yellow "!") (yellow "!")
, ppOrder = \[ws, l, _, wins] -> [ws, l, wins]
, ppExtras = [logTitles formatFocused formatUnfocused]
}
where
formatFocused = wrap (white "{") (white "}") . aqua . ppWindow . shorten 80
formatUnfocused = wrap (lowWhite "<") (lowWhite ">") . lowWhite . ppWindow . shorten 40
-- | Windows should have *some* title, which should not not exceed a
-- sane length.
ppWindow :: String -> String
ppWindow = xmobarRaw . (\w -> if null w then "untitled" else w)
blue, lowWhite, magenta, red, white, yellow :: String -> String
magenta = xmobarColor "#d3869b" ""
blue = xmobarColor "#83a598" ""
white = xmobarColor "#ebdbb2" ""
yellow = xmobarColor "#fabd2f" ""
red = xmobarColor "#fb4934" ""
green = xmobarColor "#b8bb26" ""
lowWhite = xmobarColor "#a89984" ""
aqua = xmobarColor "#8ec07c" ""
|