Add client theme options

This commit is contained in:
Martin Duquesnoy 2011-09-06 23:11:50 +02:00
parent 93496120a5
commit 5e34dcf916
6 changed files with 36 additions and 16 deletions

View File

@ -4,7 +4,9 @@
*/
#include "client.h"
#include "config.h"
#include "util.h"
#include "barwin.h"
#define CLIENT_MOUSE_MOD Mod1Mask
@ -97,7 +99,7 @@ client_focus(Client *c)
/* Unfocus selected */
if(W->client && W->client != c)
{
XSetWindowBorder(W->dpy, W->client->win, 0xfF0000);
XSetWindowBorder(W->dpy, W->client->win, THEME_DEFAULT->client_n.bg);
client_grabbuttons(W->client, false);
}
@ -107,7 +109,7 @@ client_focus(Client *c)
{
c->tag->sel = c;
XSetWindowBorder(W->dpy, c->win, 0xffffff);
XSetWindowBorder(W->dpy, c->win, THEME_DEFAULT->client_s.bg);
client_grabbuttons(c, true);
@ -202,8 +204,8 @@ client_new(Window w, XWindowAttributes *wa)
/* X window attributes */
XSelectInput(W->dpy, w, EnterWindowMask | FocusChangeMask | PropertyChangeMask | StructureNotifyMask);
XSetWindowBorder(W->dpy, w, 0xffffff);
XSetWindowBorderWidth(W->dpy, w, 1);
XSetWindowBorder(W->dpy, w, THEME_DEFAULT->client_n.bg);
XSetWindowBorderWidth(W->dpy, w, THEME_DEFAULT->client_border_width);
client_grabbuttons(c, false);
/* Attach */

View File

@ -25,6 +25,7 @@ config_theme(void)
sec = fetch_section_first(NULL, "themes");
ks = fetch_section(sec, "theme");
/* No theme section? Make one with default value anyway. */
if(!(n = fetch_section_count(ks)))
++n;
@ -40,20 +41,30 @@ config_theme(void)
wmfs_init_font(fetch_opt_first(ks[i], "fixed", "font").str, t);
/* bars */
t->bars.fg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "bars_fg").str);
t->bars.bg = color_atoh(fetch_opt_first(ks[i], "#222222", "bars_bg").str);
t->bars.fg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "bars_fg").str);
t->bars.bg = color_atoh(fetch_opt_first(ks[i], "#222222", "bars_bg").str);
t->bars_width = fetch_opt_first(ks[i], "12", "bars_width").num;
/*
* Elements
*/
t->tags_n.fg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "tags_normal_fg").str);
t->tags_n.bg = color_atoh(fetch_opt_first(ks[i], "#222222", "tags_normal_bg").str);
t->tags_s.fg = color_atoh(fetch_opt_first(ks[i], "#222222", "tags_sel_fg").str);
t->tags_s.bg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "tags_sel_bg").str);
t->tags_border_col = color_atoh(fetch_opt_first(ks[i], "#888888", "tags_border_color").str);
t->tags_n.fg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "tags_normal_fg").str);
t->tags_n.bg = color_atoh(fetch_opt_first(ks[i], "#222222", "tags_normal_bg").str);
t->tags_s.fg = color_atoh(fetch_opt_first(ks[i], "#222222", "tags_sel_fg").str);
t->tags_s.bg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "tags_sel_bg").str);
t->tags_border_col = color_atoh(fetch_opt_first(ks[i], "#888888", "tags_border_color").str);
t->tags_border_width = fetch_opt_first(ks[i], "0", "tags_border_width").num;
/* Client / Frame */
t->client_n.fg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "client_normal_fg").str);
t->client_n.bg = color_atoh(fetch_opt_first(ks[i], "#222222", "client_normal_bg").str);
t->client_s.fg = color_atoh(fetch_opt_first(ks[i], "#222222", "client_sel_fg").str);
t->client_s.bg = color_atoh(fetch_opt_first(ks[i], "#CCCCCC", "client_sel_bg").str);
t->frame_bg = color_atoh(fetch_opt_first(ks[i], "#555555", "frame_bg").str);
t->client_titlebar_width = fetch_opt_first(ks[i], "12", "client_titlebar_width").num;
t->client_border_width = fetch_opt_first(ks[i], "1", "client_border_width").num;
SLIST_INSERT_HEAD(&W->h.theme, t, next);
}

View File

@ -14,6 +14,8 @@
#include "util.h"
#include "tag.h"
#define THEME_DEFAULT (SLIST_FIRST(&W->h.theme))
static const struct { char *name; void (*func)(Uicb cmd); } uicb_list[] =
{
/* Sys */
@ -78,7 +80,7 @@ name_to_theme(const char *name)
if(!strcmp(t->name, name))
return t;
return SLIST_FIRST(&W->h.theme);
return THEME_DEFAULT;
}

View File

@ -109,8 +109,6 @@ infobar_elem_tag_update(Element *e)
barwin_refresh(b);
}
e->infobar->screen->elemupdate &= ~FLAGINT(ElemTag);
}
static void

View File

@ -64,6 +64,8 @@ infobar_elem_screen_update(Scr33n *s, int addf)
SLIST_FOREACH(i, &s->infobars, next)
infobar_elem_update(i);
s->elemupdate &= ~FLAGINT(ElemTag);
}
#endif /* INFOBAR_H */

View File

@ -185,11 +185,16 @@ struct Theme
int bars_width;
/* Elements */
struct Colpair tags_n; /* normal */
struct Colpair tags_s; /* selected */
struct Colpair tags_n, tags_s; /* normal / selected */
int tags_border_width;
Color tags_border_col;
/* Client / Frame */
struct Colpair client_n, client_s;
Color frame_bg;
int client_titlebar_width;
int client_border_width;
SLIST_ENTRY(Theme) next;
};