feat: add dispatch groupleave

This commit is contained in:
DreamMaoMao 2026-06-21 15:28:04 +08:00
parent d1cab2c4b7
commit 90c50e664d
3 changed files with 37 additions and 0 deletions

View file

@ -1020,6 +1020,8 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
} else if (strcmp(func_name, "groupjoin") == 0) {
func = groupjoin;
(*arg).i = parse_direction(arg_value);
} else if (strcmp(func_name, "groupleave") == 0) {
func = groupleave;
} else if (strcmp(func_name, "focusid") == 0) {
func = focusid;
} else if (strcmp(func_name, "incnmaster") == 0) {

View file

@ -3,6 +3,7 @@ int32_t restore_minimized(const Arg *arg);
int32_t toggle_scratchpad(const Arg *arg);
int32_t focusdir(const Arg *arg);
int32_t groupjoin(const Arg *arg);
int32_t groupleave(const Arg *arg);
int32_t toggleoverview(const Arg *arg);
int32_t togglejump(const Arg *arg);
int32_t set_proportion(const Arg *arg);

View file

@ -198,6 +198,40 @@ int32_t groupjoin(const Arg *arg) {
return 0;
}
int32_t groupleave(const Arg *arg) {
if (!selmon)
return 0;
Client *tc = arg->tc ? arg->tc : selmon->sel;
if (!tc || !tc->isgroupfocusing)
return 0;
if (!tc->group_next && !tc->group_prev) {
return 0;
}
Client *rc = tc->group_next ? tc->group_next : tc->group_prev;
client_focus_group_member(rc);
if (tc->group_prev) {
tc->group_prev->group_next = tc->group_next;
}
if (tc->group_next) {
tc->group_next->group_prev = tc->group_prev;
}
tc->group_prev = NULL;
tc->group_next = NULL;
tc->isgroupfocusing = false;
wl_list_insert(&rc->link, &tc->link);
wl_list_insert(&rc->flink, &tc->flink);
arrange(tc->mon, false, false);
return 0;
}
int32_t focuslast(const Arg *arg) {
Client *c = NULL;
Client *tc = NULL;