forked from mirror/dwl
display clients count in monocle symbol
- Replicate missing functionality from dwl to display the client count in monocle mode - Add ltsymbol field to Monitor struct - Display client count in monocle mode when greater than zero - Tested with somebar and dwlb
This commit is contained in:
parent
21930621ee
commit
bbdf2a913b
1 changed files with 10 additions and 2 deletions
12
dwl.c
12
dwl.c
|
@ -190,6 +190,7 @@ struct Monitor {
|
||||||
unsigned int tagset[2];
|
unsigned int tagset[2];
|
||||||
double mfact;
|
double mfact;
|
||||||
int nmaster;
|
int nmaster;
|
||||||
|
char ltsymbol[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -482,6 +483,8 @@ arrange(Monitor *m)
|
||||||
wlr_scene_node_set_enabled(&m->fullscreen_bg->node,
|
wlr_scene_node_set_enabled(&m->fullscreen_bg->node,
|
||||||
(c = focustop(m)) && c->isfullscreen);
|
(c = focustop(m)) && c->isfullscreen);
|
||||||
|
|
||||||
|
if (m)
|
||||||
|
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol));
|
||||||
if (m && m->lt[m->sellt]->arrange)
|
if (m && m->lt[m->sellt]->arrange)
|
||||||
m->lt[m->sellt]->arrange(m);
|
m->lt[m->sellt]->arrange(m);
|
||||||
motionnotify(0);
|
motionnotify(0);
|
||||||
|
@ -970,6 +973,7 @@ createmon(struct wl_listener *listener, void *data)
|
||||||
wlr_output_layout_add_auto(output_layout, wlr_output);
|
wlr_output_layout_add_auto(output_layout, wlr_output);
|
||||||
else
|
else
|
||||||
wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y);
|
wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y);
|
||||||
|
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1592,12 +1596,16 @@ void
|
||||||
monocle(Monitor *m)
|
monocle(Monitor *m)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||||
continue;
|
continue;
|
||||||
resize(c, m->w, 0);
|
resize(c, m->w, 0);
|
||||||
|
n++;
|
||||||
}
|
}
|
||||||
|
if (n)
|
||||||
|
snprintf(m->ltsymbol, LENGTH(m->ltsymbol), "[%d]", n);
|
||||||
if ((c = focustop(m)))
|
if ((c = focustop(m)))
|
||||||
wlr_scene_node_raise_to_top(&c->scene->node);
|
wlr_scene_node_raise_to_top(&c->scene->node);
|
||||||
}
|
}
|
||||||
|
@ -1851,7 +1859,7 @@ printstatus(void)
|
||||||
printf("%s selmon %u\n", m->wlr_output->name, m == selmon);
|
printf("%s selmon %u\n", m->wlr_output->name, m == selmon);
|
||||||
printf("%s tags %u %u %u %u\n", m->wlr_output->name, occ, m->tagset[m->seltags],
|
printf("%s tags %u %u %u %u\n", m->wlr_output->name, occ, m->tagset[m->seltags],
|
||||||
sel, urg);
|
sel, urg);
|
||||||
printf("%s layout %s\n", m->wlr_output->name, m->lt[m->sellt]->symbol);
|
printf("%s layout %s\n", m->wlr_output->name, m->ltsymbol);
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
@ -2044,7 +2052,7 @@ setlayout(const Arg *arg)
|
||||||
selmon->sellt ^= 1;
|
selmon->sellt ^= 1;
|
||||||
if (arg && arg->v)
|
if (arg && arg->v)
|
||||||
selmon->lt[selmon->sellt] = (Layout *)arg->v;
|
selmon->lt[selmon->sellt] = (Layout *)arg->v;
|
||||||
/* TODO change layout symbol? */
|
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol));
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
printstatus();
|
printstatus();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue