geoms are now drawed in the status bar
fe6b0c0f
2 file(s) · +16 −8
| 28 | 28 | ||
| 29 | 29 | Geom geoms[] = { |
|
| 30 | 30 | /* symbol function */ |
|
| 31 | - | { "[]", single }, /* first entry is default */ |
|
| 32 | - | { "[][]", dual }, |
|
| 31 | + | { "<>", single }, /* first entry is default */ |
|
| 32 | + | { ")(", dual }, |
|
| 33 | 33 | }; |
|
| 34 | 34 | ||
| 35 | 35 | /* layout(s) */ |
|
| 48 | 48 | #define MODKEY Mod1Mask |
|
| 49 | 49 | Key keys[] = { |
|
| 50 | 50 | /* modifier key function argument */ |
|
| 51 | - | { MODKEY, XK_a, setgeom, "[][]" }, |
|
| 52 | - | { MODKEY, XK_d, setgeom, "[]" }, |
|
| 51 | + | { MODKEY, XK_a, setgeom, ")(" }, |
|
| 52 | + | { MODKEY, XK_d, setgeom, "<>" }, |
|
| 53 | 53 | { MODKEY, XK_p, spawn, |
|
| 54 | 54 | "exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" }, |
|
| 55 | 55 | { MODKEY|ShiftMask, XK_Return, spawn, "exec uxterm" }, |
|
| 210 | 210 | char stext[256], buf[256]; |
|
| 211 | 211 | int screen, sx, sy, sw, sh; |
|
| 212 | 212 | int (*xerrorxlib)(Display *, XErrorEvent *); |
|
| 213 | - | int bx, by, bw, bh, blw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh; |
|
| 213 | + | int bx, by, bw, bh, blw, bgw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh; |
|
| 214 | 214 | unsigned int numlockmask = 0; |
|
| 215 | 215 | void (*handler[LASTEvent]) (XEvent *) = { |
|
| 216 | 216 | [ButtonPress] = buttonpress, |
|
| 322 | 322 | XButtonPressedEvent *ev = &e->xbutton; |
|
| 323 | 323 | ||
| 324 | 324 | if(ev->window == barwin) { |
|
| 325 | - | x = 0; |
|
| 325 | + | x = bgw; |
|
| 326 | 326 | for(i = 0; i < LENGTH(tags); i++) { |
|
| 327 | 327 | x += textw(tags[i]); |
|
| 328 | - | if(ev->x < x) { |
|
| 328 | + | if(ev->x > bgw && ev->x < x) { |
|
| 329 | 329 | if(ev->button == Button1) { |
|
| 330 | 330 | if(ev->state & MODKEY) |
|
| 331 | 331 | tag(tags[i]); |
|
| 514 | 514 | Client *c; |
|
| 515 | 515 | ||
| 516 | 516 | dc.x = 0; |
|
| 517 | + | dc.w = bgw; |
|
| 518 | + | drawtext(geom->symbol, dc.norm, False); |
|
| 519 | + | dc.x += bgw; |
|
| 517 | 520 | for(c = stack; c && !isvisible(c); c = c->snext); |
|
| 518 | 521 | for(i = 0; i < LENGTH(tags); i++) { |
|
| 519 | 522 | dc.w = textw(tags[i]); |
|
| 854 | 857 | idxoftag(const char *t) { |
|
| 855 | 858 | unsigned int i; |
|
| 856 | 859 | ||
| 857 | - | for(i = 0; (i < LENGTH(tags)) && (tags[i] != t); i++); |
|
| 860 | + | for(i = 0; (i < LENGTH(tags)) && strcmp(tags[i], t); i++); |
|
| 858 | 861 | return (i < LENGTH(tags)) ? i : 0; |
|
| 859 | 862 | } |
|
| 860 | 863 | ||
| 1500 | 1503 | i = textw(layouts[i].symbol); |
|
| 1501 | 1504 | if(i > blw) |
|
| 1502 | 1505 | blw = i; |
|
| 1506 | + | } |
|
| 1507 | + | for(bgw = i = 0; i < LENGTH(geoms); i++) { |
|
| 1508 | + | i = textw(geoms[i].symbol); |
|
| 1509 | + | if(i > bgw) |
|
| 1510 | + | bgw = i; |
|
| 1503 | 1511 | } |
|
| 1504 | 1512 | ||
| 1505 | 1513 | wa.override_redirect = 1; |
|