Add group-last command that shows only the previously active group; ok okan

This commit is contained in:
op 2022-01-27 18:45:10 +00:00
parent 81a08ddb89
commit 7c22b36a23
6 changed files with 17 additions and 0 deletions

View File

@ -214,6 +214,7 @@ struct screen_ctx {
struct region_q regionq;
struct group_q groupq;
struct group_ctx *group_active;
struct group_ctx *group_last;
Colormap colormap;
Visual *visual;
struct {
@ -501,6 +502,7 @@ void kbfunc_client_toggle_group(void *, struct cargs *);
void kbfunc_client_movetogroup(void *, struct cargs *);
void kbfunc_group_toggle(void *, struct cargs *);
void kbfunc_group_only(void *, struct cargs *);
void kbfunc_group_last(void *, struct cargs *);
void kbfunc_group_close(void *, struct cargs *);
void kbfunc_group_cycle(void *, struct cargs *);
void kbfunc_group_toggle_all(void *, struct cargs *);

1
conf.c
View File

@ -139,6 +139,7 @@ static const struct {
{ FUNC_SC(group-cycle, group_cycle, (CWM_CYCLE_FORWARD)) },
{ FUNC_SC(group-rcycle, group_cycle, (CWM_CYCLE_REVERSE)) },
{ FUNC_SC(group-last, group_last, 0) },
{ FUNC_SC(group-toggle-all, group_toggle_all, 0) },
{ FUNC_SC(group-toggle-1, group_toggle, 1) },
{ FUNC_SC(group-toggle-2, group_toggle, 2) },

View File

@ -273,6 +273,8 @@ menu.
Toggle visibility of group n, where n is 1-9.
.It group-only-[n]
Show only group n, where n is 1-9, hiding other groups.
.It group-last
Show only the previously active group.
.It group-close-[n]
Close all windows in group n, where n is 1-9.
.It group-toggle-all

View File

@ -215,6 +215,9 @@ group_only(struct screen_ctx *sc, int idx)
{
struct group_ctx *gc;
if (sc->group_last != sc->group_active)
sc->group_last = sc->group_active;
TAILQ_FOREACH(gc, &sc->groupq, entry) {
if (gc->num == idx)
group_show(gc);

View File

@ -478,6 +478,14 @@ kbfunc_group_only(void *ctx, struct cargs *cargs)
group_only(ctx, cargs->flag);
}
void
kbfunc_group_last(void *ctx, struct cargs *cargs)
{
struct screen_ctx *sc = ctx;
group_only(ctx, sc->group_last->num);
}
void
kbfunc_group_toggle(void *ctx, struct cargs *cargs)
{

View File

@ -60,6 +60,7 @@ screen_init(int which)
xu_ewmh_net_supported_wm_check(sc);
conf_group(sc);
sc->group_last = sc->group_active;
screen_update_geometry(sc);
xu_ewmh_net_desktop_names(sc);