mirror of git://git.suckless.org/dwm
added client number printing right of layout symbol
This commit is contained in:
parent
565050ac51
commit
87526be6f0
14
dwm.c
14
dwm.c
|
@ -236,7 +236,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||||
static void zoom(const Arg *arg);
|
static void zoom(const Arg *arg);
|
||||||
|
|
||||||
/* variables */
|
/* variables */
|
||||||
static char stext[256];
|
static char stext[256], ntext[8];
|
||||||
static int screen;
|
static int screen;
|
||||||
static int sw, sh; /* X display screen geometry x, y, width, height */
|
static int sw, sh; /* X display screen geometry x, y, width, height */
|
||||||
static int bh, blw = 0; /* bar geometry */
|
static int bh, blw = 0; /* bar geometry */
|
||||||
|
@ -641,11 +641,13 @@ dirtomon(int dir) {
|
||||||
void
|
void
|
||||||
drawbar(Monitor *m) {
|
drawbar(Monitor *m) {
|
||||||
int x;
|
int x;
|
||||||
unsigned int i, occ = 0, urg = 0;
|
unsigned int i, n = 0, occ = 0, urg = 0;
|
||||||
unsigned long *col;
|
unsigned long *col;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for(c = m->clients; c; c = c->next) {
|
for(c = m->clients; c; c = c->next) {
|
||||||
|
if(ISVISIBLE(c))
|
||||||
|
n++;
|
||||||
occ |= c->tags;
|
occ |= c->tags;
|
||||||
if(c->isurgent)
|
if(c->isurgent)
|
||||||
urg |= c->tags;
|
urg |= c->tags;
|
||||||
|
@ -662,10 +664,12 @@ drawbar(Monitor *m) {
|
||||||
if(blw > 0) {
|
if(blw > 0) {
|
||||||
dc.w = blw;
|
dc.w = blw;
|
||||||
drawtext(m->lt[m->sellt]->symbol, dc.norm, False);
|
drawtext(m->lt[m->sellt]->symbol, dc.norm, False);
|
||||||
x = dc.x + dc.w;
|
dc.x += dc.w;
|
||||||
}
|
}
|
||||||
else
|
snprintf(ntext, sizeof ntext, "%u", n);
|
||||||
x = dc.x;
|
dc.w = TEXTW(ntext);
|
||||||
|
drawtext(ntext, dc.norm, False);
|
||||||
|
x = (dc.x += dc.w);
|
||||||
if(m == selmon) { /* status is only drawn on selected monitor */
|
if(m == selmon) { /* status is only drawn on selected monitor */
|
||||||
dc.w = TEXTW(stext);
|
dc.w = TEXTW(stext);
|
||||||
dc.x = m->ww - dc.w;
|
dc.x = m->ww - dc.w;
|
||||||
|
|
Loading…
Reference in New Issue