This commit is contained in:
Davide Greco 2026-05-10 09:32:45 +08:00 committed by GitHub
commit f13f4515e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 2 deletions

View file

@ -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. |

View file

@ -1002,6 +1002,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) {

View file

@ -360,7 +360,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;
}

View file

@ -757,6 +757,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);
@ -4190,6 +4191,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;