merge: merged allowkillrule

This commit is contained in:
Solomon Laing 2026-03-20 17:56:13 +10:30
commit 38f1d2b44b
3 changed files with 255 additions and 269 deletions

View File

@ -4,22 +4,16 @@
static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int gappx = 6; /* gaps between windows */ static const unsigned int gappx = 6; /* gaps between windows */
static const unsigned int snap = 32;/* snap pixel */ static const unsigned int snap = 32;/* snap pixel */
static const unsigned int systraypinning = static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */
X */
static const unsigned int systrayonleft =
0; /* 0: systray in the right corner, >0: systray on left of status text */
static const unsigned int systrayspacing = 3; /* systray spacing */ static const unsigned int systrayspacing = 3; /* systray spacing */
static const int systraypinningfailfirst = static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
1; /* 1: if pinning fails, display systray on the first monitor, False:
display systray on the last monitor*/
static const int showsystray = 1; /* 0 means no systray */ static const int showsystray = 1; /* 0 means no systray */
static const int showbar = 1; /* 0 means no bar */ static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */ static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { static const int allowkill = 1; /* allow killing clients by default? */
"FiraCode Nerd Font:size=10:antialias=true:hinting=true"}; static const char *fonts[] = {"FiraCode Nerd Font:size=10:antialias=true:hinting=true"};
static const char dmenufont[] = static const char dmenufont[] = "FiraCode Nerd Font:size=10:antialias=true:hinting=true";
"FiraCode Nerd Font:size=10:antialias=true:hinting=true";
static const char norm_fg[] = "#D5C4A1"; static const char norm_fg[] = "#D5C4A1";
static const char norm_bg[] = "#262626"; static const char norm_bg[] = "#262626";
@ -46,27 +40,23 @@ static const Rule rules[] = {
* WM_CLASS(STRING) = instance, class * WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title * WM_NAME(STRING) = title
*/ */
/* class instance title tags mask isfloating /* class instance title tags mask allowkill isfloating monitor */
monitor */ {"firefox", NULL, NULL, 1 << 0, 0, 0, -1},
{"firefox", NULL, NULL, 1 << 0, 0, -1}, {"thunderbird", NULL, NULL, 1 << 6, 1, 0, -1},
{"thunderbird", NULL, NULL, 1 << 6, 0, -1}, {"org.mozilla.Thunderbird", NULL, NULL, 1 << 6, 1, 0, -1},
{"org.mozilla.Thunderbird", NULL, NULL, 1 << 6, 0, -1}, {"ManagerDesktop", NULL, NULL, 1 << 7, 1, 0, -1},
{"ManagerDesktop", NULL, NULL, 1 << 7, 0, -1}, {"Manager", NULL, NULL, 1 << 7, 1, 0, -1},
{"Manager", NULL, NULL, 1 << 7, 0, -1}, {"InputLeap", NULL, NULL, 1 << 8, 1, 1, -1},
{"InputLeap", NULL, NULL, 1 << 8, 1, -1}, {"Nextcloud", NULL, NULL, 1 << 8, 1, 0, -1},
{"Nextcloud", NULL, NULL, 1 << 8, 0, -1}, {"feishin", NULL, NULL, 1 << 2, 1, 0, -1},
{"feishin", NULL, NULL, 1 << 2, 0, -1},
}; };
/* layout(s) */ /* layout(s) */
static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */ 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 nmaster = 1; /* number of clients in master area */
static const int resizehints = static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
0; /* 1 means respect size hints in tiled resizals */ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
static const int lockfullscreen = static const int refreshrate = 120; /* refresh rate (per second) for client move/resize */
1; /* 1 will force focus on the fullscreen window */
static const int refreshrate =
120; /* refresh rate (per second) for client move/resize */
static const Layout layouts[] = { static const Layout layouts[] = {
/* symbol arrange function */ /* symbol arrange function */
@ -77,15 +67,12 @@ static const Layout layouts[] = {
/* key definitions */ /* key definitions */
#define MODKEY Mod1Mask #define MODKEY Mod1Mask
#define TAGKEYS(KEY, TAG) \ #define TAGKEYS(KEY, TAG) \
&((Keychord){1, {{MODKEY, KEY}}, view, {.ui = 1 << TAG}}), \ &((Keychord){1, {{MODKEY, KEY}}, view, {.ui = 1 << TAG}}), \
&((Keychord){ \ &((Keychord){1, {{MODKEY | ControlMask, KEY}}, toggleview, {.ui = 1 << TAG}}), \
1, {{MODKEY | ControlMask, KEY}}, toggleview, {.ui = 1 << TAG}}), \
&((Keychord){1, {{MODKEY | ShiftMask, KEY}}, tag, {.ui = 1 << TAG}}), \ &((Keychord){1, {{MODKEY | ShiftMask, KEY}}, tag, {.ui = 1 << TAG}}), \
&((Keychord){1, \ &((Keychord){1, {{MODKEY | ControlMask | ShiftMask, KEY}}, toggletag, {.ui = 1 << TAG}}),
{{MODKEY | ControlMask | ShiftMask, KEY}}, \
toggletag, \
{.ui = 1 << TAG}}),
/* helper for spawning shell commands in the pre dwm-5.0 fashion */ /* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) \ #define SHCMD(cmd) \
@ -98,8 +85,7 @@ static const Layout layouts[] = {
#define STATUSBAR "dwmblocks" #define STATUSBAR "dwmblocks"
/* commands */ /* commands */
static char dmenumon[2] = static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
"0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = {"dmenu_run", NULL}; static const char *dmenucmd[] = {"dmenu_run", NULL};
static const char *slockcmd[] = {"slock", NULL}; static const char *slockcmd[] = {"slock", NULL};
static const char *termcmd[] = {TERMINAL, "-e", "tmux-worker", NULL}; static const char *termcmd[] = {TERMINAL, "-e", "tmux-worker", NULL};
@ -109,12 +95,9 @@ static const char *termcmd[] = {TERMINAL, "-e", "tmux-worker", NULL};
#include <X11/XF86keysym.h> #include <X11/XF86keysym.h>
static const Keychord *keychords[] = { static const Keychord *keychords[] = {
/* modifier key chord function // &((Keychord){1, {{MODKEY, XK_}}, spawn, {}}),
argument */ /* key count key chords function argument */
// &((Keychord){1, {{MODKEY, XK_}}, spawn, {} &((Keychord){1, {{MODKEY | ControlMask | ShiftMask, XK_apostrophe}}, quit, {0}}),
// }),
&((Keychord){
1, {{MODKEY | ControlMask | ShiftMask, XK_apostrophe}}, quit, {0}}),
&((Keychord){1, {{MODKEY | ShiftMask, XK_apostrophe}}, quit, {1}}), &((Keychord){1, {{MODKEY | ShiftMask, XK_apostrophe}}, quit, {1}}),
&((Keychord){1, {{MODKEY, XK_apostrophe}}, killclient, {0}}), &((Keychord){1, {{MODKEY, XK_apostrophe}}, killclient, {0}}),
@ -129,14 +112,8 @@ static const Keychord *keychords[] = {
&((Keychord){1, {{MODKEY | ShiftMask, XK_h}}, shiftview, {.i = -1}}), &((Keychord){1, {{MODKEY | ShiftMask, XK_h}}, shiftview, {.i = -1}}),
&((Keychord){1, {{MODKEY | ControlMask, XK_l}}, shiftboth, {.i = +1}}), &((Keychord){1, {{MODKEY | ControlMask, XK_l}}, shiftboth, {.i = +1}}),
&((Keychord){1, {{MODKEY | ControlMask, XK_h}}, shiftboth, {.i = -1}}), &((Keychord){1, {{MODKEY | ControlMask, XK_h}}, shiftboth, {.i = -1}}),
&((Keychord){1, &((Keychord){1, {{MODKEY | ControlMask | ShiftMask, XK_l}}, shiftswaptags, {.i = +1}}),
{{MODKEY | ControlMask | ShiftMask, XK_l}}, &((Keychord){1, {{MODKEY | ControlMask | ShiftMask, XK_h}}, shiftswaptags, {.i = -1}}),
shiftswaptags,
{.i = +1}}),
&((Keychord){1,
{{MODKEY | ControlMask | ShiftMask, XK_h}},
shiftswaptags,
{.i = -1}}),
&((Keychord){1, {{MODKEY, XK_j}}, focusstack, {.i = +1}}), &((Keychord){1, {{MODKEY, XK_j}}, focusstack, {.i = +1}}),
&((Keychord){1, {{MODKEY, XK_k}}, focusstack, {.i = -1}}), &((Keychord){1, {{MODKEY, XK_k}}, focusstack, {.i = -1}}),
@ -149,12 +126,9 @@ static const Keychord *keychords[] = {
&((Keychord){1, {{MODKEY, XK_Return}}, zoom, {0}}), &((Keychord){1, {{MODKEY, XK_Return}}, zoom, {0}}),
&((Keychord){1, {{MODKEY, XK_Tab}}, view, {0}}), &((Keychord){1, {{MODKEY, XK_Tab}}, view, {0}}),
&((Keychord){ &((Keychord){2, {{MODKEY, XK_w}, {MODKEY, XK_t}}, setlayout, {.v = &layouts[0]}}),
2, {{MODKEY, XK_w}, {MODKEY, XK_t}}, setlayout, {.v = &layouts[0]}}), &((Keychord){2, {{MODKEY, XK_w}, {MODKEY, XK_m}}, setlayout, {.v = &layouts[1]}}),
&((Keychord){ &((Keychord){2, {{MODKEY, XK_w}, {MODKEY, XK_f}}, setlayout, {.v = &layouts[2]}}),
2, {{MODKEY, XK_w}, {MODKEY, XK_m}}, setlayout, {.v = &layouts[1]}}),
&((Keychord){
2, {{MODKEY, XK_w}, {MODKEY, XK_f}}, setlayout, {.v = &layouts[2]}}),
&((Keychord){1, {{MODKEY, XK_F11}}, fullscreen, {0}}), &((Keychord){1, {{MODKEY, XK_F11}}, fullscreen, {0}}),
&((Keychord){1, {{MODKEY, XK_space}}, setlayout, {0}}), &((Keychord){1, {{MODKEY, XK_space}}, setlayout, {0}}),
&((Keychord){1, {{MODKEY | ShiftMask, XK_space}}, togglefloating, {0}}), &((Keychord){1, {{MODKEY | ShiftMask, XK_space}}, togglefloating, {0}}),
@ -167,158 +141,60 @@ static const Keychord *keychords[] = {
&((Keychord){1, {{MODKEY | ShiftMask, XK_comma}}, tagmon, {.i = -1}}), &((Keychord){1, {{MODKEY | ShiftMask, XK_comma}}, tagmon, {.i = -1}}),
&((Keychord){1, {{MODKEY | ShiftMask, XK_period}}, tagmon, {.i = +1}}), &((Keychord){1, {{MODKEY | ShiftMask, XK_period}}, tagmon, {.i = +1}}),
&((Keychord){1, &((Keychord){1, {{MODKEY | ShiftMask, XK_s}}, spawn, {.v = (const char *[]){"sysact", NULL}}}),
{{MODKEY | ShiftMask, XK_s}},
spawn,
{.v = (const char *[]){"sysact", NULL}}}),
&((Keychord){1, &((Keychord){1, {{MODKEY | ShiftMask, XK_o}}, spawn, {.v = (const char *[]){"set-default-sink", NULL}}}),
{{MODKEY | ShiftMask, XK_o}}, &((Keychord){1, {{MODKEY | ShiftMask, XK_i}}, spawn, {.v = (const char *[]){"set-default-source", NULL}}}),
spawn,
{.v = (const char *[]){"set-default-sink", NULL}}}),
&((Keychord){1,
{{MODKEY | ShiftMask, XK_i}},
spawn,
{.v = (const char *[]){"set-default-source", NULL}}}),
&((Keychord){2, &((Keychord){2, {{MODKEY, XK_m}, {MODKEY, XK_a}}, spawn, {.v = (const char *[]){"dmenumusic", NULL}}}),
{{MODKEY, XK_m}, {MODKEY, XK_a}}, &((Keychord){2, {{MODKEY, XK_m}, {MODKEY, XK_p}}, spawn, {.v = (const char *[]){"mpc", "toggle", NULL}}}),
spawn, &((Keychord){2, {{MODKEY, XK_m}, {MODKEY, XK_l}}, spawn, {.v = (const char *[]){"mpc", "next", NULL}}}),
{.v = (const char *[]){"dmenumusic", NULL}}}), &((Keychord){2, {{MODKEY, XK_m}, {MODKEY, XK_h}}, spawn, {.v = (const char *[]){"mpc", "prev", NULL}}}),
&((Keychord){2, &((Keychord){1, {{MODKEY, XF86XK_AudioPlay}}, spawn, {.v = (const char *[]){"mpc", "toggle", NULL}}}),
{{MODKEY, XK_m}, {MODKEY, XK_p}}, &((Keychord){1, {{MODKEY, XF86XK_AudioNext}}, spawn, {.v = (const char *[]){"mpc", "next", NULL}}}),
spawn, &((Keychord){1, {{MODKEY, XF86XK_AudioPrev}}, spawn, {.v = (const char *[]){"mpc", "prev", NULL}}}),
{.v = (const char *[]){"mpc", "toggle", NULL}}}),
&((Keychord){2,
{{MODKEY, XK_m}, {MODKEY, XK_l}},
spawn,
{.v = (const char *[]){"mpc", "next", NULL}}}),
&((Keychord){2,
{{MODKEY, XK_m}, {MODKEY, XK_h}},
spawn,
{.v = (const char *[]){"mpc", "prev", NULL}}}),
&((Keychord){1,
{{MODKEY, XF86XK_AudioPlay}},
spawn,
{.v = (const char *[]){"mpc", "toggle", NULL}}}),
&((Keychord){1,
{{MODKEY, XF86XK_AudioNext}},
spawn,
{.v = (const char *[]){"mpc", "next", NULL}}}),
&((Keychord){1,
{{MODKEY, XF86XK_AudioPrev}},
spawn,
{.v = (const char *[]){"mpc", "prev", NULL}}}),
&((Keychord){2, &((Keychord){2, {{MODKEY, XK_o}, {MODKEY, XK_l}}, spawn, {.v = (const char *[]){TERMINAL, "-e", "lf", NULL}}}),
{{MODKEY, XK_o}, {MODKEY, XK_l}}, &((Keychord){2, {{MODKEY, XK_o}, {MODKEY, XK_f}}, spawn, {.v = (const char *[]){"firefox", NULL}}}),
spawn, &((Keychord){2, {{MODKEY, XK_o}, {MODKEY, XK_n}}, spawn, {.v = (const char *[]){TERMINAL, "-e", "ncmpcpp", NULL}}}),
{.v = (const char *[]){TERMINAL, "-e", "lf", NULL}}}), &((Keychord){2, {{MODKEY, XK_o}, {MODKEY, XK_m}}, spawn, {.v = (const char *[]){TERMINAL, "-e", "gotop", NULL}}}),
&((Keychord){2, &((Keychord){2, {{MODKEY, XK_o}, {MODKEY, XK_t}}, spawn, {.v = (const char *[]){"thunar", NULL}}}),
{{MODKEY, XK_o}, {MODKEY, XK_f}}, &((Keychord){2, {{MODKEY, XK_o}, {MODKEY, XK_c}}, spawn, {.v = (const char *[]){"calcurse-select", NULL}}}),
spawn,
{.v = (const char *[]){"firefox", NULL}}}),
&((Keychord){2,
{{MODKEY, XK_o}, {MODKEY, XK_n}},
spawn,
{.v = (const char *[]){TERMINAL, "-e", "ncmpcpp", NULL}}}),
&((Keychord){2,
{{MODKEY, XK_o}, {MODKEY, XK_m}},
spawn,
{.v = (const char *[]){TERMINAL, "-e", "gotop", NULL}}}),
&((Keychord){2,
{{MODKEY, XK_o}, {MODKEY, XK_t}},
spawn,
{.v = (const char *[]){"thunar", NULL}}}),
&((Keychord){2,
{{MODKEY, XK_o}, {MODKEY, XK_c}},
spawn,
{.v = (const char *[]){"calcurse-select", NULL}}}),
&((Keychord){2, &((Keychord){2, {{MODKEY, XK_d}, {MODKEY, XK_h}}, spawn, {.v = (const char *[]){"dmenuhandler", NULL}}}),
{{MODKEY, XK_d}, {MODKEY, XK_h}}, &((Keychord){2, {{MODKEY, XK_d}, {MODKEY, XK_m}}, spawn, {.v = (const char *[]){"mounter", NULL}}}),
spawn, &((Keychord){2, {{MODKEY, XK_d}, {MODKEY, XK_c}}, spawn, {.v = (const char *[]){"dmenumountcifs", NULL}}}),
{.v = (const char *[]){"dmenuhandler", NULL}}}), &((Keychord){2, {{MODKEY, XK_d}, {MODKEY, XK_u}}, spawn, {.v = (const char *[]){"unmounter", NULL}}}),
&((Keychord){2, &((Keychord){2, {{MODKEY, XK_d}, {MODKEY, XK_s}}, spawn, {.v = (const char *[]){"dmenusearch", "duckduckgo", NULL}}}),
{{MODKEY, XK_d}, {MODKEY, XK_m}}, &((Keychord){2, {{MODKEY, XK_d}, {MODKEY, XK_l}}, spawn, {.v = (const char *[]){"linkhandler", NULL}}}),
spawn,
{.v = (const char *[]){"mounter", NULL}}}),
&((Keychord){2,
{{MODKEY, XK_d}, {MODKEY, XK_c}},
spawn,
{.v = (const char *[]){"dmenumountcifs", NULL}}}),
&((Keychord){2,
{{MODKEY, XK_d}, {MODKEY, XK_u}},
spawn,
{.v = (const char *[]){"unmounter", NULL}}}),
&((Keychord){2,
{{MODKEY, XK_d}, {MODKEY, XK_s}},
spawn,
{.v = (const char *[]){"dmenusearch", "duckduckgo", NULL}}}),
&((Keychord){2,
{{MODKEY, XK_d}, {MODKEY, XK_l}},
spawn,
{.v = (const char *[]){"linkhandler", NULL}}}),
&((Keychord){2, &((Keychord){2, {{MODKEY, XK_d}, {MODKEY, XK_b}}, spawn, SHCMD("dmenu-bluetooth -i -l 25")}),
{{MODKEY, XK_d}, {MODKEY, XK_b}},
spawn,
SHCMD("dmenu-bluetooth -i -l 25")}),
&((Keychord){1, &((Keychord){1, {{MODKEY | ControlMask, XK_period}}, spawn, {.v = (const char *[]){"sd", NULL}}}),
{{MODKEY | ControlMask, XK_period}},
spawn,
{.v = (const char *[]){"sd", NULL}}}),
&((Keychord){1, &((Keychord){1, {{MODKEY, XK_f}}, spawn, {.v = (const char *[]){"screenlayout", NULL}}}),
{{MODKEY, XK_f}},
spawn,
{.v = (const char *[]){"screenlayout", NULL}}}),
&((Keychord){1, &((Keychord){1, {{MODKEY, XK_F1}}, spawn, {.v = (const char *[]){"kbswitcher", NULL}}}),
{{MODKEY, XK_F1}},
spawn,
{.v = (const char *[]){"kbswitcher", NULL}}}),
&((Keychord){ &((Keychord){1, {{0, XF86XK_AudioMute}}, spawn, SHCMD("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; kill -37 $(pidof " "dwmblocks)")}),
1, &((Keychord){1, {{0, XF86XK_AudioRaiseVolume}}, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+; kill -37 $(pidof " "dwmblocks)")}),
{{0, XF86XK_AudioMute}}, &((Keychord){1, {{0, XF86XK_AudioLowerVolume}}, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-; kill -37 $(pidof " "dwmblocks)")}),
spawn, &((Keychord){1, {{0, XF86XK_AudioMicMute}}, spawn, SHCMD("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle; kill -37 $(pidof " "dwmblocks)")}),
SHCMD("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; kill -37 $(pidof " &((Keychord){1, {{MODKEY, XK_v}}, spawn, {.v = (const char *[]){"setvol", NULL}}}),
"dwmblocks)")}),
&((Keychord){
1,
{{0, XF86XK_AudioRaiseVolume}},
spawn,
SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+; kill -37 $(pidof "
"dwmblocks)")}),
&((Keychord){
1,
{{0, XF86XK_AudioLowerVolume}},
spawn,
SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-; kill -37 $(pidof "
"dwmblocks)")}),
&((Keychord){
1,
{{0, XF86XK_AudioMicMute}},
spawn,
SHCMD("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle; kill -37 $(pidof "
"dwmblocks)")}),
&((Keychord){
1, {{MODKEY, XK_v}}, spawn, {.v = (const char *[]){"setvol", NULL}}}),
&((Keychord){1, &((Keychord){1, {{0, XF86XK_MonBrightnessUp}}, spawn, {.v = (const char *[]){"mod_backlight", "up", NULL}}}),
{{0, XF86XK_MonBrightnessUp}}, &((Keychord){1, {{0, XF86XK_MonBrightnessDown}}, spawn, {.v = (const char *[]){"mod_backlight", "down", NULL}}}),
spawn,
{.v = (const char *[]){"mod_backlight", "up", NULL}}}),
&((Keychord){1,
{{0, XF86XK_MonBrightnessDown}},
spawn,
{.v = (const char *[]){"mod_backlight", "down", NULL}}}),
TAGKEYS(XK_1, 0) TAGKEYS(XK_2, 1) TAGKEYS(XK_3, 2) TAGKEYS(XK_4, 3) TAGKEYS(XK_1, 0)
TAGKEYS(XK_5, 4) TAGKEYS(XK_6, 5) TAGKEYS(XK_7, 6) TAGKEYS(XK_8, 7) TAGKEYS(XK_2, 1)
TAGKEYS(XK_9, 8)}; 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)
};
/* button definitions */ /* button definitions */
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,

View File

@ -0,0 +1,98 @@
diff -up a/config.def.h b/config.def.h
--- a/config.def.h 2022-10-04 19:38:18.000000000 +0200
+++ b/config.def.h 2023-05-06 22:19:27.298742237 +0200
@@ -5,6 +5,7 @@ static const unsigned int borderpx = 1;
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
+static const int allowkill = 1; /* allow killing clients by default? */
static const char *fonts[] = { "monospace:size=10" };
static const char dmenufont[] = "monospace:size=10";
static const char col_gray1[] = "#222222";
@@ -26,9 +27,9 @@ static const Rule rules[] = {
* 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 },
+ /* class instance title tags mask allowkill isfloating monitor */
+ { "Gimp", NULL, NULL, 0, 1, 1, -1 },
+ { "Firefox", NULL, NULL, 1 << 8, 1, 0, -1 },
};
/* layout(s) */
@@ -78,6 +79,7 @@ static const Key keys[] = {
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
+ { MODKEY, XK_q, toggleallowkill,{0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
diff -up a/dwm.c b/dwm.c
--- a/dwm.c 2022-10-04 19:38:18.000000000 +0200
+++ b/dwm.c 2023-05-06 22:18:43.239357744 +0200
@@ -93,6 +93,7 @@ struct Client {
int bw, oldbw;
unsigned int tags;
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
+ int allowkill;
Client *next;
Client *snext;
Monitor *mon;
@@ -137,6 +138,7 @@ typedef struct {
const char *instance;
const char *title;
unsigned int tags;
+ int allowkill;
int isfloating;
int monitor;
} Rule;
@@ -212,6 +214,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *m);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
+static void toggleallowkill(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unfocus(Client *c, int setfocus);
@@ -288,6 +291,7 @@ applyrules(Client *c)
/* rule matching */
c->isfloating = 0;
c->tags = 0;
+ c->allowkill = allowkill;
XGetClassHint(dpy, c->win, &ch);
class = ch.res_class ? ch.res_class : broken;
instance = ch.res_name ? ch.res_name : broken;
@@ -300,6 +304,7 @@ applyrules(Client *c)
{
c->isfloating = r->isfloating;
c->tags |= r->tags;
+ c->allowkill = r->allowkill;
for (m = mons; m && m->num != r->monitor; m = m->next);
if (m)
c->mon = m;
@@ -1006,7 +1011,7 @@ keypress(XEvent *e)
void
killclient(const Arg *arg)
{
- if (!selmon->sel)
+ if (!selmon->sel || !selmon->sel->allowkill)
return;
if (!sendevent(selmon->sel, wmatom[WMDelete])) {
XGrabServer(dpy);
@@ -1704,6 +1709,13 @@ togglebar(const Arg *arg)
}
void
+toggleallowkill(const Arg *arg)
+{
+ if (!selmon->sel) return;
+ selmon->sel->allowkill = !selmon->sel->allowkill;
+}
+
+void
togglefloating(const Arg *arg)
{
if (!selmon->sel)

14
dwm.c
View File

@ -108,6 +108,7 @@ struct Client {
int bw, oldbw; int bw, oldbw;
unsigned int tags; unsigned int tags;
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
int allowkill;
Client *next; Client *next;
Client *snext; Client *snext;
Monitor *mon; Monitor *mon;
@ -159,6 +160,7 @@ typedef struct {
const char *instance; const char *instance;
const char *title; const char *title;
unsigned int tags; unsigned int tags;
int allowkill;
int isfloating; int isfloating;
int monitor; int monitor;
} Rule; } Rule;
@ -251,6 +253,7 @@ static void tagmon(const Arg *arg);
static void tile(Monitor *m); static void tile(Monitor *m);
static void togglebar(const Arg *arg); static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg); static void togglefloating(const Arg *arg);
static void toggleallowkill(const Arg *arg);
static void toggletag(const Arg *arg); static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg); static void toggleview(const Arg *arg);
static void unfocus(Client *c, int setfocus); static void unfocus(Client *c, int setfocus);
@ -347,6 +350,7 @@ applyrules(Client *c)
/* rule matching */ /* rule matching */
c->isfloating = 0; c->isfloating = 0;
c->tags = 0; c->tags = 0;
c->allowkill = allowkill;
XGetClassHint(dpy, c->win, &ch); XGetClassHint(dpy, c->win, &ch);
class = ch.res_class ? ch.res_class : broken; class = ch.res_class ? ch.res_class : broken;
instance = ch.res_name ? ch.res_name : broken; instance = ch.res_name ? ch.res_name : broken;
@ -359,6 +363,7 @@ applyrules(Client *c)
{ {
c->isfloating = r->isfloating; c->isfloating = r->isfloating;
c->tags |= r->tags; c->tags |= r->tags;
c->allowkill = r->allowkill;
for (m = mons; m && m->num != r->monitor; m = m->next); for (m = mons; m && m->num != r->monitor; m = m->next);
if (m) if (m)
c->mon = m; c->mon = m;
@ -1284,7 +1289,7 @@ keypress(XEvent *e)
void void
killclient(const Arg *arg) killclient(const Arg *arg)
{ {
if (!selmon->sel) if (!selmon->sel || !selmon->sel->allowkill)
return; return;
if (!sendevent(selmon->sel->win, wmatom[WMDelete], NoEventMask, wmatom[WMDelete], CurrentTime, 0 , 0, 0)) { if (!sendevent(selmon->sel->win, wmatom[WMDelete], NoEventMask, wmatom[WMDelete], CurrentTime, 0 , 0, 0)) {
@ -2151,6 +2156,13 @@ togglebar(const Arg *arg)
arrange(selmon); arrange(selmon);
} }
void
toggleallowkill(const Arg *arg)
{
if (!selmon->sel) return;
selmon->sel->allowkill = !selmon->sel->allowkill;
}
void void
togglefloating(const Arg *arg) togglefloating(const Arg *arg)
{ {