summaryrefslogtreecommitdiff
path: root/.config/dwm
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2026-05-06 08:10:01 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2026-05-06 08:22:22 +0200
commit10e16c2fb2266bb2b46ec7ea64d721de0c29a0d9 (patch)
treeee719d25f2a15ec9bb5de52f4b703578487184b6 /.config/dwm
parent6e4f65568cbf8cfad5e1bccb02db01880ef2ea5f (diff)
downloadconfig-10e16c2fb2266bb2b46ec7ea64d721de0c29a0d9.tar.gz
config-10e16c2fb2266bb2b46ec7ea64d721de0c29a0d9.zip
Suckless software configs
Diffstat (limited to '.config/dwm')
-rw-r--r--.config/dwm/config.h229
1 files changed, 229 insertions, 0 deletions
diff --git a/.config/dwm/config.h b/.config/dwm/config.h
new file mode 100644
index 0000000..1a98237
--- /dev/null
+++ b/.config/dwm/config.h
@@ -0,0 +1,229 @@
1/* See LICENSE file for copyright and license details. */
2
3/* appearance */
4static const unsigned int borderpx = 3; /* border pixel of windows */
5static const unsigned int snap = 32; /* snap pixel */
6static const int showbar = 1; /* 0 means no bar */
7static const int topbar = 1; /* 0 means bottom bar */
8static const char *fonts[] = { "monospace:size=18" };
9static const char dmenufont[] = "monospace:size=18";
10
11/* Dark scheme: */
12/*
13static const char col_gray1[] = "#141414";
14static const char col_gray2[] = "#504945";
15static const char col_gray3[] = "#bdae93";
16static const char col_gray4[] = "#f9f9f9";
17static const char col_cyan[] = "#3465a4";
18*/
19
20/* Light theme: */
21static const char col_gray1[] = "#fffff8";
22static const char col_gray2[] = "#000000";
23static const char col_gray3[] = "#000000";
24static const char col_gray4[] = "#000000";
25static const char col_cyan[] = "#f0f0f4";
26
27static const char *colors[][3] = {
28 /* fg bg border */
29 [SchemeNorm] = { col_gray3, col_gray1, col_cyan },
30 [SchemeSel] = { col_gray4, col_cyan, col_gray2 },
31};
32
33/* tagging */
34static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
35
36static const Rule rules[] = {
37 /* xprop(1):
38 * WM_CLASS(STRING) = instance, class
39 * WM_NAME(STRING) = title
40 */
41 /* class | instance | title | tagsmask | isfloating | monitor */
42 { "TelegramDesktop", NULL, NULL, 1 << 6, 0, -1 },
43 { NULL, NULL, "stfloat", 0, 1, -1 },
44 { NULL, NULL, "Picture-in-Picture", TAGMASK, 1, -1 },
45};
46
47/* layout(s) */
48static const float mfact = 0.5; /* factor of master area */
49static const int nmaster = 1; /* number of clients in master area */
50static const int resizehints = 0; /* 1 means respect size hints */
51static const int refreshrate = 120; /* refresh rate (per second) for client move/resize */
52static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
53
54static const Layout layouts[] = {
55 /* symbol arrange function */
56 { "[]=", tile }, /* first entry is default */
57 { "><>", NULL }, /* no layout function means floating behavior */
58 { "[M]", monocle },
59};
60
61/* key definitions */
62#define MODKEY Mod1Mask
63#define TAGKEYS(KEY,TAG) \
64 { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
65 { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
66 { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
67 { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
68
69/* helper for spawning shell commands in the pre dwm-5.0 fashion */
70#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
71
72/* commands */
73static const char *termcmd[] = { "st", NULL };
74static char dmenumon[2] = "0"; /* used in dmenucmd, manipulated in spawn() */
75static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL };
76/* Colors in dmenu config.h built from source
77static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon,
78 "-fn", dmenufont,
79 "-nb", col_gray1,
80 "-nf", col_gray3,
81 "-sb", col_cyan,
82 "-sf", col_gray4, NULL };
83*/
84
85/* Necessary library for some multimedia key names */
86#include <X11/XF86keysym.h>
87
88/* My zoomstack function; passing .i=1 means always focus stack */
89void
90zoomstack(const Arg *arg)
91{
92 int s = 0;
93 unsigned int j;
94 Monitor *m = selmon;
95 Client *c = selmon->sel, *f, **p;
96
97 if (!m->lt[m->sellt]->arrange)
98 return;
99
100 if (!c || (c && c->isfloating)) {
101 c = nexttiled(m->clients);
102 s = 1;
103 }
104
105 for (j = 0, f = nexttiled(m->clients); f && j < m->nmaster;
106 f = nexttiled(f->next), j++) {
107 if (f == c) {
108 c = nexttiled(c->next);
109 s = 1;
110 }
111 }
112 if (c && f == c)
113 c = nexttiled(c->next);
114 for (p = &m->clients; *p && (*p)->next != f; p = &(*p)->next);
115 if (!*p || !c)
116 return;
117 detach(c);
118 c->next = (*p)->next;
119 (*p)->next = c;
120 arrange(m);
121 if (!s || arg->i)
122 focus(c);
123}
124
125/* Focusmater by Mateus Auler - <mateusauler at protonmail dot com>
126 * Taken from https://dwm.suckless.org/patches/focusmaster */
127void
128focusmaster(const Arg *arg)
129{
130 Client *c;
131
132 if (selmon->nmaster < 1)
133 return;
134
135 c = nexttiled(selmon->clients);
136
137 if (c)
138 focus(c);
139}
140
141static Key keys[] = {
142 /* modifier key function argument */
143 { MODKEY, XK_p, spawn, {.v = dmenucmd} },
144 { MODKEY, XK_n, togglebar, {0} },
145 { MODKEY, XK_j, focusstack, {.i = +1 } },
146 { MODKEY, XK_k, focusstack, {.i = -1 } },
147 { MODKEY|ControlMask, XK_d, incnmaster, {.i = +1 } },
148 { MODKEY|ControlMask|ShiftMask, XK_d, incnmaster, {.i = -1 } },
149 { MODKEY, XK_h, setmfact, {.f = -0.05} },
150 { MODKEY, XK_l, setmfact, {.f = +0.05} },
151 { MODKEY, XK_Tab, view, {0} },
152 { MODKEY|ShiftMask, XK_c, killclient, {0} },
153 { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
154 { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
155 { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
156 { MODKEY, XK_s, togglefloating, {0} },
157 { MODKEY, XK_Return, zoom, {0} },
158 { MODKEY, XK_0, view, {.ui = ~0 } },
159 { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
160 { MODKEY, XK_comma, focusmon, {.i = -1 } },
161 { MODKEY, XK_period, focusmon, {.i = +1 } },
162 { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
163 { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
164 TAGKEYS( XK_1, 0)
165 TAGKEYS( XK_2, 1)
166 TAGKEYS( XK_3, 2)
167 TAGKEYS( XK_4, 3)
168 TAGKEYS( XK_5, 4)
169 TAGKEYS( XK_6, 5)
170 TAGKEYS( XK_7, 6)
171 TAGKEYS( XK_8, 7)
172 TAGKEYS( XK_9, 8)
173
174 /* Session */
175 { MODKEY|ShiftMask, XK_q, spawn, SHCMD("dmenu-dwm-sessionmanager") },
176 { MODKEY|ShiftMask, XK_z, spawn, SHCMD("slock") },
177
178 /* Programs */
179 { MODKEY|ShiftMask, XK_Return, spawn, SHCMD("terminal") },
180 { MODKEY|ShiftMask, XK_backslash, spawn, SHCMD("popup-terminal") },
181 { MODKEY|ShiftMask, XK_f, spawn, SHCMD("firefox") },
182 { MODKEY|ShiftMask, XK_g, spawn, SHCMD("xedit") },
183 { MODKEY|ShiftMask, XK_j, spawn, SHCMD("terminal bc -q $HOME/box/bc.library") },
184 { MODKEY, XK_y, spawn, SHCMD("clip") },
185 { MODKEY, XK_d, spawn, SHCMD("popup-cal12") },
186 { MODKEY, XK_q, spawn, SHCMD("dmenu-unmount") },
187 { MODKEY, XK_e, spawn, SHCMD("dmenu-bookmarks") },
188 { MODKEY|ShiftMask, XK_u, spawn, SHCMD("feed menu") },
189
190 /* System settings */
191 { MODKEY|ShiftMask, XK_w, spawn, SHCMD("popup-terminal iwctl") },
192 { MODKEY|ShiftMask, XK_v, spawn, SHCMD("popup-terminal pulsemixer") },
193 { MODKEY|ShiftMask, XK_b, spawn, SHCMD("popup-terminal bluetoothctl") },
194 { MODKEY|ShiftMask, XK_p, spawn, SHCMD("popup-terminal top") },
195
196 /* Multimedia */
197 { 0, XK_Print, spawn, SHCMD("dmenu-screenshot") },
198 { 0, XF86XK_MonBrightnessUp, spawn, SHCMD("xbacklight -inc 5") },
199 { 0, XF86XK_MonBrightnessDown, spawn, SHCMD("xbacklight -dec 5") },
200 { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pulsemixer --change-volume +5 && xroot-update") },
201 { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pulsemixer --change-volume -5 && xroot-update") },
202 { 0, XF86XK_AudioMute, spawn, SHCMD("pulsemixer --toggle-mute && xroot-update") },
203
204 /* zoomstack (.i = 1: always focus) and others */
205 { MODKEY, XK_backslash, zoomstack, {.i = 0} },
206 { MODKEY|ControlMask, XK_Return, focusmaster, {0} },
207
208 /* Notify */
209 { ControlMask, XK_space, spawn, SHCMD("notify clean") },
210 { ControlMask|ShiftMask, XK_space, spawn, SHCMD("popup-terminal 'notify show | less'") },
211};
212
213/* button definitions */
214/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
215static Button buttons[] = {
216 /* click event mask button function argument */
217 { ClkLtSymbol, 0, Button1, setlayout, {0} },
218 { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
219 { ClkWinTitle, 0, Button2, zoom, {0} },
220 { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
221 { ClkClientWin, MODKEY, Button1, movemouse, {0} },
222 { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
223 { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
224 { ClkTagBar, 0, Button1, view, {0} },
225 { ClkTagBar, 0, Button3, toggleview, {0} },
226 { ClkTagBar, MODKEY, Button1, tag, {0} },
227 { ClkTagBar, MODKEY, Button3, toggletag, {0} },
228};
229

Generated with cgit - Back to sebastiano.tronto.net