mirror of
https://github.com/bakkeby/dwm-flexipatch
synced 2024-11-05 00:00:18 +00:00
Added clientindicators patch and unified and simplified indicator code. Enabled centeredwindowname option for awesomebar and bartabgroups patches.
This commit is contained in:
parent
32819a48f3
commit
46ebaea58f
66
patch/bar_indicators.c
Normal file
66
patch/bar_indicators.c
Normal file
@ -0,0 +1,66 @@
|
||||
/* Indicator properties, you can override these in your config.h if you want. */
|
||||
#ifndef TAGSINDICATOR
|
||||
#define TAGSINDICATOR 1 // 0 = off, 1 = on if >1 client/view tag, 2 = always on
|
||||
#endif
|
||||
#ifndef TAGSPX
|
||||
#define TAGSPX 5 // # pixels for tag grid boxes
|
||||
#endif
|
||||
#ifndef TAGSROWS
|
||||
#define TAGSROWS 3 // # rows in tag grid (9 tags, e.g. 3x3)
|
||||
#endif
|
||||
|
||||
void
|
||||
drawindicator(Monitor *m, Client *c, unsigned int occ, int x, int w, unsigned int tag, int filled, int invert, int type)
|
||||
{
|
||||
int i, boxw, boxs, indn = 0;
|
||||
if (!(occ & 1 << tag))
|
||||
return;
|
||||
|
||||
boxs = drw->fonts->h / 9;
|
||||
boxw = drw->fonts->h / 6 + 2;
|
||||
if (filled == -1)
|
||||
filled = m == selmon && m->sel && m->sel->tags & 1 << tag;
|
||||
|
||||
switch (type) {
|
||||
default:
|
||||
case INDICATOR_TOP_LEFT_SQUARE:
|
||||
drw_rect(drw, x + boxs, boxs, boxw, boxw, filled, invert);
|
||||
break;
|
||||
case INDICATOR_TOP_LEFT_LARGER_SQUARE:
|
||||
drw_rect(drw, x + boxs + 2, boxs+1, boxw+1, boxw+1, filled, invert);
|
||||
break;
|
||||
case INDICATOR_TOP_BAR:
|
||||
drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw/2, filled, invert);
|
||||
break;
|
||||
case INDICATOR_BOTTOM_BAR:
|
||||
drw_rect(drw, x + boxw, bh - boxw/2, w - ( 2 * boxw + 1), boxw/2, 1, invert);
|
||||
break;
|
||||
case INDICATOR_CLIENT_DOTS:
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
if (c->tags & (1 << tag)) {
|
||||
drw_rect(drw, x, 1 + (indn * 2), m->sel == c ? 6 : 1, 1, 1, invert);
|
||||
indn++;
|
||||
}
|
||||
if (bh <= 1 + (indn * 2)) {
|
||||
indn = 0;
|
||||
x += 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case INDICATOR_RIGHT_TAGS:
|
||||
if (!c)
|
||||
break;
|
||||
for (i = 0; i < LENGTH(tags); i++) {
|
||||
drw_rect(drw,
|
||||
( x + w - 2 - ((LENGTH(tags) / TAGSROWS) * TAGSPX)
|
||||
- (i % (LENGTH(tags)/TAGSROWS)) + ((i % (LENGTH(tags) / TAGSROWS)) * TAGSPX)
|
||||
),
|
||||
( 2 + ((i / (LENGTH(tags)/TAGSROWS)) * TAGSPX)
|
||||
- ((i / (LENGTH(tags)/TAGSROWS)))
|
||||
),
|
||||
TAGSPX, TAGSPX, (c->tags >> i) & 1, 0
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
10
patch/bar_indicators.h
Normal file
10
patch/bar_indicators.h
Normal file
@ -0,0 +1,10 @@
|
||||
enum {
|
||||
INDICATOR_TOP_LEFT_SQUARE,
|
||||
INDICATOR_TOP_LEFT_LARGER_SQUARE,
|
||||
INDICATOR_TOP_BAR,
|
||||
INDICATOR_BOTTOM_BAR,
|
||||
INDICATOR_CLIENT_DOTS,
|
||||
INDICATOR_RIGHT_TAGS
|
||||
};
|
||||
|
||||
static void drawindicator(Monitor *m, Client *c, unsigned int occ, int x, int w, unsigned int tag, int filled, int invert, int type);
|
Loading…
Reference in New Issue
Block a user