Adds killclient_byappid to internal commands

This commit is contained in:
Jon H 2026-03-20 13:29:22 -07:00
parent f3336eae68
commit df1d622649
3 changed files with 20 additions and 1 deletions

View file

@ -989,7 +989,10 @@ 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;
} else if (strcmp(func_name, "centerwin") == 0) {
} else if (strcmp(func_name, "killclient_byappid") == 0) {
func = killclient_byappid;
(*arg).v = strdup(arg_value);
} else if (strcmp(func_name, "centerwin") == 0) {
func = centerwin;
} else if (strcmp(func_name, "focuslast") == 0) {
func = focuslast;

View file

@ -34,6 +34,7 @@ int32_t exchange_client(const Arg *arg);
int32_t exchange_stack_client(const Arg *arg);
int32_t exchange_stack_client_bounded(const Arg *arg);
int32_t killclient(const Arg *arg);
int32_t killclient_byappid(const Arg *arg);
int32_t toggleglobal(const Arg *arg);
int32_t incnmaster(const Arg *arg);
int32_t focusmon(const Arg *arg);

View file

@ -409,6 +409,21 @@ int32_t killclient(const Arg *arg) {
return 0;
}
int32_t killclient_byappid(const Arg *arg) {
Client *c = NULL;
/* No Arg? No Kill. */
if (!arg || !arg->v)
return 0;
/* for some reason its warning me about this indent? */
wl_list_for_each(c, &clients, link) {
if (strcmp((*arg).v, client_get_appid(c)) == 0) {
pending_kill_client(c);
}
}
return 0;
}
int32_t moveresize(const Arg *arg) {
const char *cursors[] = {"nw-resize", "ne-resize", "sw-resize",
"se-resize"};