geoms are now drawed in the status bar
This commit is contained in:
parent
aa2395b6a8
commit
fe6b0c0fc1
2 changed files with 16 additions and 8 deletions
|
@ -28,8 +28,8 @@ DEFGEOM(dual, 0, 0,1280, 0, bh, ww, wh-bh, wx, wy, 1280,800-bh, 1280, 0, w
|
||||||
|
|
||||||
Geom geoms[] = {
|
Geom geoms[] = {
|
||||||
/* symbol function */
|
/* symbol function */
|
||||||
{ "[]", single }, /* first entry is default */
|
{ "<>", single }, /* first entry is default */
|
||||||
{ "[][]", dual },
|
{ ")(", dual },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
|
@ -48,8 +48,8 @@ Layout layouts[] = {
|
||||||
#define MODKEY Mod1Mask
|
#define MODKEY Mod1Mask
|
||||||
Key keys[] = {
|
Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY, XK_a, setgeom, "[][]" },
|
{ MODKEY, XK_a, setgeom, ")(" },
|
||||||
{ MODKEY, XK_d, setgeom, "[]" },
|
{ MODKEY, XK_d, setgeom, "<>" },
|
||||||
{ MODKEY, XK_p, spawn,
|
{ MODKEY, XK_p, spawn,
|
||||||
"exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" },
|
"exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" },
|
||||||
{ MODKEY|ShiftMask, XK_Return, spawn, "exec uxterm" },
|
{ MODKEY|ShiftMask, XK_Return, spawn, "exec uxterm" },
|
||||||
|
|
16
dwm.c
16
dwm.c
|
@ -210,7 +210,7 @@ void zoom(const char *arg);
|
||||||
char stext[256], buf[256];
|
char stext[256], buf[256];
|
||||||
int screen, sx, sy, sw, sh;
|
int screen, sx, sy, sw, sh;
|
||||||
int (*xerrorxlib)(Display *, XErrorEvent *);
|
int (*xerrorxlib)(Display *, XErrorEvent *);
|
||||||
int bx, by, bw, bh, blw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh;
|
int bx, by, bw, bh, blw, bgw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh;
|
||||||
unsigned int numlockmask = 0;
|
unsigned int numlockmask = 0;
|
||||||
void (*handler[LASTEvent]) (XEvent *) = {
|
void (*handler[LASTEvent]) (XEvent *) = {
|
||||||
[ButtonPress] = buttonpress,
|
[ButtonPress] = buttonpress,
|
||||||
|
@ -322,10 +322,10 @@ buttonpress(XEvent *e) {
|
||||||
XButtonPressedEvent *ev = &e->xbutton;
|
XButtonPressedEvent *ev = &e->xbutton;
|
||||||
|
|
||||||
if(ev->window == barwin) {
|
if(ev->window == barwin) {
|
||||||
x = 0;
|
x = bgw;
|
||||||
for(i = 0; i < LENGTH(tags); i++) {
|
for(i = 0; i < LENGTH(tags); i++) {
|
||||||
x += textw(tags[i]);
|
x += textw(tags[i]);
|
||||||
if(ev->x < x) {
|
if(ev->x > bgw && ev->x < x) {
|
||||||
if(ev->button == Button1) {
|
if(ev->button == Button1) {
|
||||||
if(ev->state & MODKEY)
|
if(ev->state & MODKEY)
|
||||||
tag(tags[i]);
|
tag(tags[i]);
|
||||||
|
@ -514,6 +514,9 @@ drawbar(void) {
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
dc.x = 0;
|
dc.x = 0;
|
||||||
|
dc.w = bgw;
|
||||||
|
drawtext(geom->symbol, dc.norm, False);
|
||||||
|
dc.x += bgw;
|
||||||
for(c = stack; c && !isvisible(c); c = c->snext);
|
for(c = stack; c && !isvisible(c); c = c->snext);
|
||||||
for(i = 0; i < LENGTH(tags); i++) {
|
for(i = 0; i < LENGTH(tags); i++) {
|
||||||
dc.w = textw(tags[i]);
|
dc.w = textw(tags[i]);
|
||||||
|
@ -854,7 +857,7 @@ unsigned int
|
||||||
idxoftag(const char *t) {
|
idxoftag(const char *t) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for(i = 0; (i < LENGTH(tags)) && (tags[i] != t); i++);
|
for(i = 0; (i < LENGTH(tags)) && strcmp(tags[i], t); i++);
|
||||||
return (i < LENGTH(tags)) ? i : 0;
|
return (i < LENGTH(tags)) ? i : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1501,6 +1504,11 @@ setup(void) {
|
||||||
if(i > blw)
|
if(i > blw)
|
||||||
blw = i;
|
blw = i;
|
||||||
}
|
}
|
||||||
|
for(bgw = i = 0; i < LENGTH(geoms); i++) {
|
||||||
|
i = textw(geoms[i].symbol);
|
||||||
|
if(i > bgw)
|
||||||
|
bgw = i;
|
||||||
|
}
|
||||||
|
|
||||||
wa.override_redirect = 1;
|
wa.override_redirect = 1;
|
||||||
wa.background_pixmap = ParentRelative;
|
wa.background_pixmap = ParentRelative;
|
||||||
|
|
Loading…
Reference in a new issue