diff --git a/src/config/parse_config.h b/src/config/parse_config.h index bdca5389..0bc26a7f 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -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) { diff --git a/src/dispatch/bind_declare.h b/src/dispatch/bind_declare.h index ee59d604..056ae82c 100644 --- a/src/dispatch/bind_declare.h +++ b/src/dispatch/bind_declare.h @@ -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); diff --git a/src/dispatch/bind_define.h b/src/dispatch/bind_define.h index 44282b94..34195530 100644 --- a/src/dispatch/bind_define.h +++ b/src/dispatch/bind_define.h @@ -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;