-
Notifications
You must be signed in to change notification settings - Fork 8
/
config.h
256 lines (199 loc) · 8.28 KB
/
config.h
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
// -------------------------------- Appearance ---------------------------------
// border pixel of windows
static const unsigned int borderpx = 1;
// gaps between windows
static const unsigned int gappx = 6;
// snap pixel
static const unsigned int snap = 32;
// 0: sloppy systray follows selected monitor, >0: pin systray to monitor X
static const unsigned int systraypinning = 0;
// systray spacing
static const unsigned int systrayspacing = 2;
// 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor
static const int systraypinningfailfirst = 1;
// 0 means no systray
static const int showsystray = 1;
// 0 means no bar
static const int showbar = 1;
// 0 means bottom bar
static const int topbar = 1;
// ---------------------------------- Fonts ------------------------------------
static const char *fonts[] = { "UbuntuMono Nerd Font:size=14:weight=bold:antialias=true:autohint:true" };
static const char dmenufont[] = "UbuntuMono Nerd Font:size=12:antialias=true:autohint=true";
// ---------------------------------- Colors -----------------------------------
struct Theme {
char *inactive;
char *active;
char *bg;
char *focus;
};
static const struct Theme material = {
.inactive = "#4c566a",
.active = "#ffffff",
.bg = "#0f101a",
.focus = "#a151d3"
};
static const struct Theme onedark = {
.inactive = "#4c566a",
.active = "#ffffff",
.bg = "#1e2127",
.focus = "#E06C75"
};
static const struct Theme nord = {
.inactive = "#4c566a",
.active = "#ffffff",
.bg = "#2e3440",
.focus = "#81a1c1"
};
static const struct Theme monokai_pro = {
.inactive = "#727072",
.active = "#2d2a2e",
.bg = "#2d2a2e",
.focus = "#a9dc76"
};
static const char window_border[] = "#000000";
static const char *colors[][3] = {
// fg bg border
{ material.inactive, material.bg, window_border },
{ material.active, material.focus, material.focus },
{ onedark.inactive, onedark.bg, window_border },
{ onedark.active, onedark.focus, onedark.focus },
{ nord.inactive, nord.bg, window_border },
{ nord.active, nord.focus, nord.focus },
{ monokai_pro.inactive, monokai_pro.bg, window_border },
{ monokai_pro.active, monokai_pro.focus, monokai_pro.focus },
};
// -------------------------------- Workspaces ---------------------------------
static const char *tags[] = { " ", " ", " ", " ", " ", " ", " ", " ", " " };
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
// class instance title tags mask isfloating monitor
{ "Gimp", NULL, NULL, 0, 1, -1 },
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
};
// ---------------------------------- Layouts ----------------------------------
static const float mfact = 0.50; // factor of master area size [0.05..0.95]
static const int nmaster = 1; // number of clients in master area
static const int resizehints = 1; // 1 means respect size hints in tiled resizals
#include "layouts.c"
static const Layout layouts[] = {
// symbol arrange function
{ "[]", tile }, // first entry is default
{ "[F]", NULL }, // no layout function means floating behavior
{ "[M]", monocle },
{ "[C]", tcl },
{ "[G]", grid },
{ NULL, NULL },
};
// -------------------------------- Keybindings --------------------------------
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
// Helper for spawning shell commands in the pre dwm-5.0 fashion
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
// Commands
static char dmenumon[2] = "0";
static const char *termcmd[] = { "alacritty", NULL };
static const char *dmenucmd[] = {
"dmenu_run", "-m", dmenumon,
"-fn", dmenufont,
NULL
};
#include <X11/XF86keysym.h>
static Key keys[] = {
// ------------------ Windows ------------------
// Switch between windows
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
// Change window sizes
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY|ShiftMask, XK_i, incnmaster, {.i = -1 } },
{ MODKEY|ShiftMask, XK_h, setmfact, {.f = -0.05} },
{ MODKEY|ShiftMask, XK_l, setmfact, {.f = +0.05} },
// Toggle floating
{ MODKEY|ShiftMask, XK_f, togglefloating, {0} },
// Toggle bar
{ MODKEY|ShiftMask, XK_b, togglebar, {0} },
// Move windows in current stack
{ MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } },
{ MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } },
// Cycle layouts
{ MODKEY, XK_Tab, cyclelayout, {.i = +1 } },
{ MODKEY|ShiftMask, XK_Tab, cyclelayout, {.i = -1 } },
// Increase - decrease gaps
{ MODKEY, XK_g, setgaps, {.i = -1 } },
{ MODKEY|ShiftMask, XK_g, setgaps, {.i = +1 } },
// Focus next - prev monitor
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
// Send window to next - prev monitor
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
// Change color scheme
{ MODKEY, XK_Left, schemeToggle, {0} },
{ MODKEY, XK_Right, schemeCycle, {0} },
// Kill window
{ MODKEY, XK_w, killclient, {0} },
// Restart dwm
{ MODKEY|ControlMask, XK_r, quit, {1} },
// Quit dwm
{ MODKEY|ControlMask, XK_q, quit, {0} },
// ---------------- Workspaces -----------------
TAGKEYS(XK_1, 0)
TAGKEYS(XK_2, 1)
TAGKEYS(XK_3, 2)
TAGKEYS(XK_4, 3)
TAGKEYS(XK_5, 4)
TAGKEYS(XK_6, 5)
TAGKEYS(XK_7, 6)
TAGKEYS(XK_8, 7)
TAGKEYS(XK_9, 8)
// ------------------- Apps --------------------
// dmenu
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = dmenucmd } },
// rofi
{ MODKEY, XK_m, spawn, SHCMD("rofi -show drun") },
// Window nav (rofi)
{ MODKEY|ShiftMask, XK_m, spawn, SHCMD("rofi -show") },
// Terminal
{ MODKEY, XK_Return, spawn, SHCMD("alacritty") },
// File explorer
{ MODKEY, XK_e, spawn, SHCMD("pcmanfm") },
// Browser
{ MODKEY, XK_b, spawn, SHCMD("firefox") },
// Redshift
{ MODKEY, XK_r, spawn, SHCMD("redshift -O 2400") },
{ MODKEY|ShiftMask, XK_r, spawn, SHCMD("redshift -x") },
// Screenshot
{ MODKEY, XK_s, spawn, SHCMD("scrot") },
{ MODKEY|ShiftMask, XK_s, spawn, SHCMD("scrot -s") },
// ----------------- Hardware ------------------
// Volume
{0, XF86XK_AudioLowerVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ -5%")},
{0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ +5%")},
{0, XF86XK_AudioMute, spawn, SHCMD("pactl set-sink-mute @DEFAULT_SINK@ toggle")},
// Brightness
{0, XF86XK_MonBrightnessUp, spawn, SHCMD("brightnessctl set +10%")},
{0, XF86XK_MonBrightnessDown, spawn, SHCMD("brightnessctl set 10%-")},
};
// click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin
static Button buttons[] = {
// click event mask button function argument
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};