mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Introduce a check to see if a group holds only 'sticky' clients and use
this check to decide if a group is virtually empty. Rationale: if a group contains *only* 'sticky' clients, it should be skipped while cycling through groups. Apply similar logic to the group menu. Based on an idea from phessler@, who also tested another version.
This commit is contained in:
parent
4b6dc96398
commit
74f4a1bad9
2
calmwm.h
2
calmwm.h
@ -407,11 +407,11 @@ void group_cycle(struct screen_ctx *, int);
|
|||||||
int group_hidden_state(struct group_ctx *);
|
int group_hidden_state(struct group_ctx *);
|
||||||
void group_hide(struct group_ctx *);
|
void group_hide(struct group_ctx *);
|
||||||
void group_hidetoggle(struct screen_ctx *, int);
|
void group_hidetoggle(struct screen_ctx *, int);
|
||||||
|
int group_holds_only_sticky(struct group_ctx *);
|
||||||
void group_init(struct screen_ctx *);
|
void group_init(struct screen_ctx *);
|
||||||
void group_movetogroup(struct client_ctx *, int);
|
void group_movetogroup(struct client_ctx *, int);
|
||||||
void group_only(struct screen_ctx *, int);
|
void group_only(struct screen_ctx *, int);
|
||||||
void group_show(struct group_ctx *);
|
void group_show(struct group_ctx *);
|
||||||
void group_sticky(struct client_ctx *);
|
|
||||||
void group_sticky_toggle_enter(struct client_ctx *);
|
void group_sticky_toggle_enter(struct client_ctx *);
|
||||||
void group_sticky_toggle_exit(struct client_ctx *);
|
void group_sticky_toggle_exit(struct client_ctx *);
|
||||||
void group_update_names(struct screen_ctx *);
|
void group_update_names(struct screen_ctx *);
|
||||||
|
15
group.c
15
group.c
@ -202,6 +202,19 @@ group_sticky_toggle_exit(struct client_ctx *cc)
|
|||||||
client_draw_border(cc);
|
client_draw_border(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
group_holds_only_sticky(struct group_ctx *gc)
|
||||||
|
{
|
||||||
|
struct client_ctx *cc;
|
||||||
|
|
||||||
|
/* Check if all clients in the group are 'sticky'. */
|
||||||
|
TAILQ_FOREACH(cc, &gc->clientq, group_entry) {
|
||||||
|
if (!(cc->flags & CLIENT_STICKY))
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If all clients in a group are hidden, then the group state is hidden.
|
* If all clients in a group are hidden, then the group state is hidden.
|
||||||
*/
|
*/
|
||||||
@ -283,7 +296,7 @@ group_cycle(struct screen_ctx *sc, int flags)
|
|||||||
if (gc == sc->group_active)
|
if (gc == sc->group_active)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!TAILQ_EMPTY(&gc->clientq) && showgroup == NULL)
|
if (!group_holds_only_sticky(gc) && showgroup == NULL)
|
||||||
showgroup = gc;
|
showgroup = gc;
|
||||||
else if (!group_hidden_state(gc))
|
else if (!group_hidden_state(gc))
|
||||||
group_hide(gc);
|
group_hide(gc);
|
||||||
|
@ -188,7 +188,7 @@ mousefunc_menu_group(struct client_ctx *cc, union arg *arg)
|
|||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
||||||
if (TAILQ_EMPTY(&gc->clientq))
|
if (group_holds_only_sticky(gc))
|
||||||
continue;
|
continue;
|
||||||
menuq_add(&menuq, gc,
|
menuq_add(&menuq, gc,
|
||||||
group_hidden_state(gc) ? "%d: [%s]" : "%d: %s",
|
group_hidden_state(gc) ? "%d: [%s]" : "%d: %s",
|
||||||
|
Loading…
Reference in New Issue
Block a user