From 15f17dd62b737c84239fc6fefb1b94102754b3f9 Mon Sep 17 00:00:00 2001 From: Davide Greco Date: Fri, 13 Mar 2026 17:02:00 +0100 Subject: [PATCH 1/2] add force kill option --- src/config/parse_config.h | 1 + src/dispatch/bind_define.h | 6 +++++- src/mango.c | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/config/parse_config.h b/src/config/parse_config.h index ffb8414b..2e4b1f5a 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -977,6 +977,7 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value, (*arg).i = atoi(arg_value); } else if (strcmp(func_name, "killclient") == 0) { func = killclient; + (*arg).v = strdup(arg_value); } else if (strcmp(func_name, "centerwin") == 0) { func = centerwin; } else if (strcmp(func_name, "focuslast") == 0) { diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index 449adf3b..92ea4b2e 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -356,7 +356,11 @@ int32_t killclient(const Arg *arg) { return 0; c = selmon->sel; if (c) { - pending_kill_client(c); + if (arg->v && strcmp(arg->v, "force") == 0) { + pending_force_kill_client(c); + } else { + pending_kill_client(c); + } } return 0; } diff --git a/src/mango.c b/src/mango.c index aedf1d6e..e5c8ef7e 100644 --- a/src/mango.c +++ b/src/mango.c @@ -751,6 +751,7 @@ static bool check_hit_no_border(Client *c); static void reset_keyboard_layout(void); static void client_update_oldmonname_record(Client *c, Monitor *m); static void pending_kill_client(Client *c); +static void pending_force_kill_client(Client *c); static uint32_t get_tags_first_tag_num(uint32_t source_tags); static void set_layer_open_animaiton(LayerSurface *l, struct wlr_box geo); static void init_fadeout_layers(LayerSurface *l); @@ -3919,6 +3920,13 @@ void keypressmod(struct wl_listener *listener, void *data) { } } +void pending_force_kill_client(Client *c) { + if (!c) + return; + kill(c->pid, SIGKILL); +} + + void pending_kill_client(Client *c) { if (!c || c->iskilling) return; From 98c2c9ce454b3d6fd52fe8c48a14cda88f361ddd Mon Sep 17 00:00:00 2001 From: Davide Greco Date: Sun, 26 Apr 2026 20:11:24 +0200 Subject: [PATCH 2/2] docs: add force option --- docs/bindings/keys.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/bindings/keys.md b/docs/bindings/keys.md index b3a4ab64..60299b97 100644 --- a/docs/bindings/keys.md +++ b/docs/bindings/keys.md @@ -88,7 +88,7 @@ bindr=Super,Super_L,spawn,rofi -show run | Command | Param | Description | | :--- | :--- | :--- | -| `killclient` | - | Close the focused window. | +| `killclient` | `force` | Close the focused window. If `force` is specified, sends `SIGKILL`. | | `togglefloating` | - | Toggle floating state. | | `toggle_all_floating` | - | Toggle all visible clients floating state. | | `togglefullscreen` | - | Toggle fullscreen. |