Conf: Buttons as indicators of client mode (Feature #33)

This commit is contained in:
OldMan 2010-03-25 19:53:00 +01:00
parent 06a9c44792
commit c350bb45d0
4 changed files with 29 additions and 7 deletions

View File

@ -264,6 +264,15 @@ conf_client_section(char *src)
cfg_set_sauv(tmp2); cfg_set_sauv(tmp2);
tmp3 = get_opt(tmp2, "none", "flags").str;
conf.titlebar.button[i].flags = 0;
if(strstr(tmp3, "free"))
conf.titlebar.button[i].flags |= FreeFlag;
if(strstr(tmp3, "max"))
conf.titlebar.button[i].flags |= MaxFlag;
if(strstr(tmp3, "tile"))
conf.titlebar.button[i].flags |= TileFlag;
/* Multi mouse section */ /* Multi mouse section */
if((conf.titlebar.button[i].nmouse = get_size_sec(tmp2, "mouse"))) if((conf.titlebar.button[i].nmouse = get_size_sec(tmp2, "mouse")))
{ {

View File

@ -220,6 +220,13 @@ frame_update(Client *c)
{ {
XSetWindowBackground(dpy, c->button[i], c->colors.frame); XSetWindowBackground(dpy, c->button[i], c->colors.frame);
XClearWindow(dpy, c->button[i]); XClearWindow(dpy, c->button[i]);
if((!conf.titlebar.button[i].flags)
|| ((conf.titlebar.button[i].flags & FreeFlag) && (c->flags & FreeFlag))
|| ((conf.titlebar.button[i].flags & MaxFlag) && (c->flags & MaxFlag))
|| ((conf.titlebar.button[i].flags & TileFlag) && (c->flags & TileFlag)))
{
XSetWindowBorder(dpy, c->button[i], getcolor(c->colors.fg)); XSetWindowBorder(dpy, c->button[i], getcolor(c->colors.fg));
/* Button's lines */ /* Button's lines */
@ -231,6 +238,9 @@ frame_update(Client *c)
conf.titlebar.button[i].nlines); conf.titlebar.button[i].nlines);
} }
} }
else
XSetWindowBorder(dpy, c->button[i], c->colors.frame);
}
} }
barwin_refresh(c->titlebar); barwin_refresh(c->titlebar);

View File

@ -303,6 +303,7 @@ typedef struct
XSegment *linecoord; XSegment *linecoord;
int nlines; int nlines;
int nmouse; int nmouse;
uint flags;
} Button; } Button;
/* Alias struct */ /* Alias struct */

View File

@ -111,6 +111,8 @@
[mouse] button = "3" func = "mouse_resize" [/mouse] [mouse] button = "3" func = "mouse_resize" [/mouse]
[button] [button]
# Available "free", "max", "tile" flags of button.
flags = "free,max,tile"
[mouse] button = "1" func = "client_kill" [/mouse] [mouse] button = "1" func = "client_kill" [/mouse]
[mouse] button = "3" func = "menu" cmd = "clientmenu" [/mouse] [mouse] button = "3" func = "menu" cmd = "clientmenu" [/mouse]