Change colors handling
This commit is contained in:
parent
a0ba05b904
commit
9dfd488dda
|
@ -123,6 +123,7 @@ config_parse(const char *confpatharg, const char *menu_title, Area *geometry)
|
|||
char *confpath, *opt;
|
||||
cfg_t *cfg, *cfg_menu = NULL, *cfg_screen, *cfg_general,
|
||||
*cfg_colors, *cfg_menu_colors = NULL;
|
||||
colors_ctx_t colors_normal, colors_focus;
|
||||
|
||||
if(!confpatharg)
|
||||
confpath = config_file();
|
||||
|
@ -157,41 +158,34 @@ config_parse(const char *confpatharg, const char *menu_title, Area *geometry)
|
|||
cfg_general = cfg_getsec(cfg_screen, "general");
|
||||
cfg_colors = cfg_getsec(cfg_screen, "colors");
|
||||
|
||||
/* colors */
|
||||
if(!cfg_menu_colors || !(opt = cfg_getstr(cfg_menu_colors, "normal_fg")))
|
||||
opt = cfg_getstr(cfg_colors, "normal_fg");
|
||||
/* Colors */
|
||||
|
||||
draw_color_new(globalconf.display, DefaultScreen(globalconf.display),
|
||||
opt, &globalconf.colors.normal.fg);
|
||||
/* Grab default colors */
|
||||
draw_colors_ctx_init(globalconf.display, DefaultScreen(globalconf.display),
|
||||
cfg_getsec(cfg_colors, "normal"),
|
||||
&colors_normal, NULL);
|
||||
|
||||
if(!cfg_menu_colors || !(opt = cfg_getstr(cfg_menu_colors, "normal_bg")))
|
||||
opt = cfg_getstr(cfg_colors, "normal_bg");
|
||||
draw_colors_ctx_init(globalconf.display, DefaultScreen(globalconf.display),
|
||||
cfg_getsec(cfg_colors, "normal"),
|
||||
&colors_normal, NULL);
|
||||
|
||||
draw_color_new(globalconf.display, DefaultScreen(globalconf.display),
|
||||
opt, &globalconf.colors.normal.bg);
|
||||
/* Now grab menu colors if any */
|
||||
draw_colors_ctx_init(globalconf.display, DefaultScreen(globalconf.display),
|
||||
cfg_getsec(cfg_colors, "normal"),
|
||||
&globalconf.colors.normal, &colors_normal);
|
||||
|
||||
if(!cfg_menu_colors || !(opt = cfg_getstr(cfg_menu_colors, "focus_fg")))
|
||||
opt = cfg_getstr(cfg_colors, "focus_fg");
|
||||
|
||||
draw_color_new(globalconf.display, DefaultScreen(globalconf.display),
|
||||
opt, &globalconf.colors.focus.fg);
|
||||
|
||||
if(!cfg_menu_colors || !(opt = cfg_getstr(cfg_menu_colors, "focus_bg")))
|
||||
opt = cfg_getstr(cfg_colors, "focus_bg");
|
||||
|
||||
draw_color_new(globalconf.display, DefaultScreen(globalconf.display),
|
||||
opt, &globalconf.colors.focus.bg);
|
||||
draw_colors_ctx_init(globalconf.display, DefaultScreen(globalconf.display),
|
||||
cfg_getsec(cfg_colors, "focus"),
|
||||
&globalconf.colors.focus, &colors_focus);
|
||||
|
||||
/* font */
|
||||
if(!cfg_menu || !(opt = cfg_getstr(cfg_menu, "font")))
|
||||
opt = cfg_getstr(cfg_general, "font");
|
||||
|
||||
globalconf.font = XftFontOpenName(globalconf.display, DefaultScreen(globalconf.display),
|
||||
globalconf.font = XftFontOpenName(globalconf.display,
|
||||
DefaultScreen(globalconf.display),
|
||||
opt);
|
||||
|
||||
globalconf.colors.normal.shadow_offset =
|
||||
globalconf.colors.focus.shadow_offset = cfg_getint(cfg_general, "text_shadow_offset");
|
||||
|
||||
if(cfg_menu)
|
||||
{
|
||||
if((i = cfg_getint(cfg_menu, "x")) != (int) 0xffffffff)
|
||||
|
|
|
@ -102,14 +102,9 @@ config_parse(const char *confpatharg)
|
|||
cfg_colors = cfg_getsec(cfg_screen, "colors");
|
||||
|
||||
/* colors */
|
||||
draw_color_new(globalconf.display, DefaultScreen(globalconf.display),
|
||||
cfg_getstr(cfg_colors, "normal_fg"),
|
||||
&globalconf.colors.fg);
|
||||
draw_color_new(globalconf.display, DefaultScreen(globalconf.display),
|
||||
cfg_getstr(cfg_colors, "normal_bg"),
|
||||
&globalconf.colors.bg);
|
||||
|
||||
globalconf.colors.shadow_offset = cfg_getint(cfg_general, "text_shadow_offset");
|
||||
draw_colors_ctx_init(globalconf.display, DefaultScreen(globalconf.display),
|
||||
cfg_getsec(cfg_colors, "normal"),
|
||||
&globalconf.colors, NULL);
|
||||
|
||||
/* font */
|
||||
globalconf.font = XftFontOpenName(globalconf.display, DefaultScreen(globalconf.display),
|
||||
|
|
|
@ -100,26 +100,19 @@ image::
|
|||
|
||||
colors
|
||||
^^^^^^
|
||||
Colors is a section containing the color parameters.
|
||||
Colors is a section containing the colors parameters which is composed of a normal, focus and urgent
|
||||
subsection each ones containing:
|
||||
|
||||
normal_fg::
|
||||
Set the normal foreground color.
|
||||
normal_bg::
|
||||
Set the normal background color.
|
||||
normal_border::
|
||||
Set the unfocused window's border color.
|
||||
focus_fg::
|
||||
Set the focused foreground color.
|
||||
focus_bg::
|
||||
Set the focused background color.
|
||||
focus_border::
|
||||
Set the focused window's border color.
|
||||
urgent_fg::
|
||||
Set the foreground color to use for urgent flag. This is mostly useful
|
||||
with the taglist widget which will use this color whenever a window sets its
|
||||
XUrgencyHint on a non-visible tag.
|
||||
urgent_bg::
|
||||
Set the background color to use for urgent flag.
|
||||
fg::
|
||||
Set the foreground color.
|
||||
bg::
|
||||
Set the background color.
|
||||
border::
|
||||
Set the window's border color.
|
||||
shadow::
|
||||
Set the shadow color.
|
||||
shadow_offset::
|
||||
Set the shadow offset in pixel.
|
||||
|
||||
padding
|
||||
^^^^^^^
|
||||
|
@ -393,12 +386,8 @@ This widget shows a list of running windows.
|
|||
Font to use.
|
||||
*bg*::
|
||||
Background color.
|
||||
*fg*::
|
||||
Foreground color.
|
||||
*focus_bg*::
|
||||
Background color for focused window.
|
||||
*focus_fg*::
|
||||
Foreground color for focused window.
|
||||
*colors*::
|
||||
Colors section with a focus and normal subsection.
|
||||
*text_align*::
|
||||
Text alignement.
|
||||
*show_icons*::
|
||||
|
@ -418,12 +407,10 @@ This widget shows a text.
|
|||
Set mouse bindings.
|
||||
*font*::
|
||||
Font to use.
|
||||
*bg*::
|
||||
Background color.
|
||||
*fg*::
|
||||
Foreground color.
|
||||
*width*::
|
||||
Set width.
|
||||
*colors*::
|
||||
Colors section with a focus and normal subsection.
|
||||
*text*::
|
||||
Text to change.
|
||||
*text_align*::
|
||||
|
@ -551,11 +538,11 @@ Note: when there is no whitespace, quotes are optional.
|
|||
<uicb-arg> -> prog, 3... (argument to a uicb function, where required)
|
||||
<uicb-cmd> -> spawn, exec, client_tag... (see UICB FUNCTIONS above)
|
||||
<{.., ...}> -> list of available options
|
||||
<color section> -> a section with fg, bg, border, shadow and shadow_offset options.
|
||||
|
||||
[MULTI] means, you can use an item multiple times.
|
||||
|
||||
|
||||
|
||||
screen <integer> [MULTI]
|
||||
{
|
||||
general
|
||||
|
@ -570,7 +557,6 @@ screen <integer> [MULTI]
|
|||
sloppy_focus_raise = <boolean>
|
||||
snap = <integer>
|
||||
floating_placement = <{smart,under_mouse}>
|
||||
text_shadow_offset = <int>
|
||||
mwfact_lower_limit = <float>
|
||||
mwfact_upper_limit = <float>
|
||||
}
|
||||
|
@ -593,14 +579,9 @@ screen <integer> [MULTI]
|
|||
}
|
||||
colors
|
||||
{
|
||||
normal_fg = <color>
|
||||
normal_bg = <color>
|
||||
normal_border = <color>
|
||||
focus_fg = <color>
|
||||
focus_bg = <color>
|
||||
focus_border = <color>
|
||||
urgent_fg = <color>
|
||||
urgent_bg = <color>
|
||||
normal { <color section> }
|
||||
focus { <color section> }
|
||||
urgent { <color section> }
|
||||
}
|
||||
padding
|
||||
{
|
||||
|
@ -647,10 +628,11 @@ screen <integer> [MULTI]
|
|||
}
|
||||
tasklist <identifier>
|
||||
{
|
||||
fg = <color>
|
||||
bg = <color>
|
||||
focus_fg = <color>
|
||||
focus_bg = <color>
|
||||
colors
|
||||
{
|
||||
normal { <color section> }
|
||||
focus { <color section> }
|
||||
}
|
||||
font = <font>
|
||||
show_icons = <boolean>
|
||||
show = <{all,tags,focus}>
|
||||
|
|
|
@ -77,7 +77,6 @@ cfg_opt_t general_opts[] =
|
|||
CFG_BOOL((char *) "new_become_master", cfg_true, CFGF_NONE),
|
||||
CFG_BOOL((char *) "new_get_focus", cfg_true, CFGF_NONE),
|
||||
CFG_STR((char *) "font", (char *) "vera-10", CFGF_NONE),
|
||||
CFG_INT((char *) "text_shadow_offset", 1, CFGF_NONE),
|
||||
CFG_INT((char *) "opacity_unfocused", -1, CFGF_NONE),
|
||||
CFG_STR((char *) "floating_placement", (char *) "smart", CFGF_NONE),
|
||||
CFG_FLOAT((char *) "mwfact_lower_limit", 0.1, CFGF_NONE),
|
||||
|
@ -86,14 +85,18 @@ cfg_opt_t general_opts[] =
|
|||
};
|
||||
cfg_opt_t colors_opts[] =
|
||||
{
|
||||
CFG_STR((char *) "normal_border", (char *) "#111111", CFGF_NONE),
|
||||
CFG_STR((char *) "normal_bg", (char *) "#111111", CFGF_NONE),
|
||||
CFG_STR((char *) "normal_fg", (char *) "#eeeeee", CFGF_NONE),
|
||||
CFG_STR((char *) "focus_border", (char *) "#6666ff", CFGF_NONE),
|
||||
CFG_STR((char *) "focus_bg", (char *) "#6666ff", CFGF_NONE),
|
||||
CFG_STR((char *) "focus_fg", (char *) "#ffffff", CFGF_NONE),
|
||||
CFG_STR((char *) "urgent_bg", (char *) "#ff0000", CFGF_NONE),
|
||||
CFG_STR((char *) "urgent_fg", (char *) "#ffffff", CFGF_NONE),
|
||||
CFG_STR((char *) "border", (char *) NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "bg", (char *) NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "fg", (char *) NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "shadow", (char *) NULL, CFGF_NONE),
|
||||
CFG_INT((char *) "shadow_offset", 0, CFGF_NONE),
|
||||
CFG_AWESOME_END()
|
||||
};
|
||||
cfg_opt_t screen_colors_opts[] =
|
||||
{
|
||||
CFG_SEC((char *) "normal", colors_opts, CFGF_NONE),
|
||||
CFG_SEC((char *) "focus", colors_opts, CFGF_NONE),
|
||||
CFG_SEC((char *) "urgent", colors_opts, CFGF_NONE),
|
||||
CFG_AWESOME_END()
|
||||
};
|
||||
cfg_opt_t mouse_taglist_opts[] =
|
||||
|
@ -145,10 +148,9 @@ cfg_opt_t widget_textbox_opts[] =
|
|||
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
|
||||
CFG_INT((char *) "width", 0, CFGF_NONE),
|
||||
CFG_STR((char *) "text", (char *) NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "fg", (char *) NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "bg", (char *) NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "font", (char *) NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "text_align", (char *) "center", CFGF_NONE),
|
||||
CFG_SEC((char *) "colors", colors_opts, CFGF_NONE),
|
||||
CFG_AWESOME_END()
|
||||
};
|
||||
cfg_opt_t widget_tasklist_opts[] =
|
||||
|
@ -156,10 +158,7 @@ cfg_opt_t widget_tasklist_opts[] =
|
|||
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
|
||||
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
|
||||
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
|
||||
CFG_STR((char *) "fg", (char *) NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "bg", (char *) NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "focus_fg", (char *) NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "focus_bg", (char *) NULL, CFGF_NONE),
|
||||
CFG_SEC((char *) "colors", screen_colors_opts, CFGF_NONE),
|
||||
CFG_STR((char *) "font", (char *) NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "text_align", (char *) "left", CFGF_NONE),
|
||||
CFG_STR((char *) "show", (char *) "tags", CFGF_NONE),
|
||||
|
@ -266,7 +265,7 @@ cfg_opt_t screen_opts[] =
|
|||
CFG_SEC((char *) "general", general_opts, CFGF_NONE),
|
||||
CFG_SEC((char *) "statusbar", statusbar_opts, CFGF_TITLE | CFGF_MULTI | CFGF_NO_TITLE_DUPES),
|
||||
CFG_SEC((char *) "tags", tags_opts, CFGF_NONE),
|
||||
CFG_SEC((char *) "colors", colors_opts, CFGF_NONE),
|
||||
CFG_SEC((char *) "colors", screen_colors_opts, CFGF_NONE),
|
||||
CFG_SEC((char *) "layouts", layouts_opts, CFGF_NONE),
|
||||
CFG_SEC((char *) "padding", padding_opts, CFGF_NONE),
|
||||
CFG_AWESOME_END()
|
||||
|
@ -317,14 +316,6 @@ cfg_opt_t mouse_opts[] =
|
|||
CFG_SEC((char *) "client", mouse_generic_opts, CFGF_MULTI),
|
||||
CFG_AWESOME_END()
|
||||
};
|
||||
cfg_opt_t menu_colors_opts[] =
|
||||
{
|
||||
CFG_STR((char *) "normal_bg", NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "normal_fg", NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "focus_bg", NULL, CFGF_NONE),
|
||||
CFG_STR((char *) "focus_fg", NULL, CFGF_NONE),
|
||||
CFG_AWESOME_END()
|
||||
};
|
||||
cfg_opt_t menu_opts[] =
|
||||
{
|
||||
CFG_INT((char *) "width", 0, CFGF_NONE),
|
||||
|
@ -332,7 +323,7 @@ cfg_opt_t menu_opts[] =
|
|||
CFG_INT((char *) "y", 0xffffffff, CFGF_NONE),
|
||||
CFG_INT((char *) "x", 0xffffffff, CFGF_NONE),
|
||||
CFG_STR((char *) "font", NULL, CFGF_NONE),
|
||||
CFG_SEC((char *) "colors", menu_colors_opts, CFGF_NONE),
|
||||
CFG_SEC((char *) "colors", screen_colors_opts, CFGF_NONE),
|
||||
CFG_AWESOME_END()
|
||||
};
|
||||
cfg_opt_t awesome_opts[] =
|
||||
|
|
|
@ -657,6 +657,9 @@ draw_color_new(Display *disp, int phys_screen, const char *colstr, XColor *color
|
|||
Bool ret;
|
||||
XColor exactColor;
|
||||
|
||||
if(!a_strlen(colstr))
|
||||
return False;
|
||||
|
||||
if(!(ret = XAllocNamedColor(disp,
|
||||
DefaultColormap(disp, phys_screen),
|
||||
colstr,
|
||||
|
@ -667,6 +670,25 @@ draw_color_new(Display *disp, int phys_screen, const char *colstr, XColor *color
|
|||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
draw_colors_ctx_init(Display *disp, int phys_screen, cfg_t *cfg_colors,
|
||||
colors_ctx_t *c, colors_ctx_t *m)
|
||||
{
|
||||
if(m)
|
||||
*c = *m;
|
||||
|
||||
draw_color_new(disp, phys_screen,
|
||||
cfg_getstr(cfg_colors, "fg"), &c->fg);
|
||||
draw_color_new(disp, phys_screen,
|
||||
cfg_getstr(cfg_colors, "bg"), &c->bg);
|
||||
draw_color_new(disp, phys_screen,
|
||||
cfg_getstr(cfg_colors, "border"), &c->border);
|
||||
draw_color_new(disp, phys_screen,
|
||||
cfg_getstr(cfg_colors, "shadow"), &c->shadow);
|
||||
|
||||
c->shadow_offset = cfg_getint(cfg_colors, "shadow_offset");
|
||||
}
|
||||
|
||||
/** Remove a area from a list of them,
|
||||
* spliting the space between several area that can overlaps
|
||||
* \param head list head
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#define AWESOME_COMMON_DRAW_H
|
||||
|
||||
#include <cairo.h>
|
||||
|
||||
#include <confuse.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xft/Xft.h>
|
||||
|
||||
|
@ -123,6 +126,7 @@ Drawable draw_rotate(DrawCtx *, int, double, int, int);
|
|||
unsigned short draw_textwidth(Display *, XftFont *, char *);
|
||||
Alignment draw_get_align(const char *);
|
||||
Bool draw_color_new(Display *, int, const char *, XColor *);
|
||||
void draw_colors_ctx_init(Display *, int, cfg_t *, colors_ctx_t *, colors_ctx_t *);
|
||||
|
||||
void area_list_remove(Area **, Area *);
|
||||
|
||||
|
|
41
config.c
41
config.c
|
@ -282,7 +282,8 @@ config_parse_screen(cfg_t *cfg, int screen)
|
|||
Tag *tag = NULL;
|
||||
Statusbar *statusbar = NULL;
|
||||
cfg_t *cfg_general, *cfg_colors, *cfg_screen, *cfg_tags,
|
||||
*cfg_layouts, *cfg_padding, *cfgsectmp;
|
||||
*cfg_layouts, *cfg_padding, *cfgsectmp,
|
||||
*cfg_colors_normal, *cfg_colors_focus, *cfg_colors_urgent;
|
||||
VirtScreen *virtscreen = &globalconf.screens[screen];
|
||||
int i, phys_screen = get_phys_screen(screen);
|
||||
|
||||
|
@ -318,10 +319,6 @@ config_parse_screen(cfg_t *cfg, int screen)
|
|||
virtscreen->font = XftFontOpenName(globalconf.display,
|
||||
phys_screen,
|
||||
cfg_getstr(cfg_general, "font"));
|
||||
virtscreen->colors.normal.shadow_offset =
|
||||
virtscreen->colors.focus.shadow_offset =
|
||||
virtscreen->colors.urgent.shadow_offset =
|
||||
cfg_getint(cfg_general, "text_shadow_offset");
|
||||
virtscreen->floating_placement =
|
||||
name_func_lookup(cfg_getstr(cfg_general, "floating_placement"),
|
||||
FloatingPlacementList);
|
||||
|
@ -360,30 +357,16 @@ config_parse_screen(cfg_t *cfg, int screen)
|
|||
eprint("awesome: cannot init font\n");
|
||||
|
||||
/* Colors */
|
||||
draw_color_new(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "normal_border"),
|
||||
&virtscreen->colors.normal.border);
|
||||
draw_color_new(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "normal_bg"),
|
||||
&virtscreen->colors.normal.bg);
|
||||
draw_color_new(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "normal_fg"),
|
||||
&virtscreen->colors.normal.fg);
|
||||
draw_color_new(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "focus_border"),
|
||||
&virtscreen->colors.focus.border);
|
||||
draw_color_new(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "focus_bg"),
|
||||
&virtscreen->colors.focus.bg);
|
||||
draw_color_new(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "focus_fg"),
|
||||
&virtscreen->colors.focus.fg);
|
||||
draw_color_new(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "urgent_bg"),
|
||||
&virtscreen->colors.urgent.bg);
|
||||
draw_color_new(globalconf.display, phys_screen,
|
||||
cfg_getstr(cfg_colors, "urgent_fg"),
|
||||
&virtscreen->colors.urgent.fg);
|
||||
cfg_colors_normal = cfg_getsec(cfg_colors, "normal");
|
||||
cfg_colors_focus = cfg_getsec(cfg_colors, "focus");
|
||||
cfg_colors_urgent = cfg_getsec(cfg_colors, "urgent");
|
||||
|
||||
draw_colors_ctx_init(globalconf.display, phys_screen,
|
||||
cfg_colors_normal, &virtscreen->colors.normal, NULL);
|
||||
draw_colors_ctx_init(globalconf.display, phys_screen,
|
||||
cfg_colors_focus, &virtscreen->colors.focus, NULL);
|
||||
draw_colors_ctx_init(globalconf.display, phys_screen,
|
||||
cfg_colors_urgent, &virtscreen->colors.urgent, NULL);
|
||||
|
||||
/* Statusbar */
|
||||
|
||||
|
|
|
@ -268,6 +268,7 @@ tasklist_new(Statusbar *statusbar, cfg_t *config)
|
|||
Widget *w;
|
||||
Data *d;
|
||||
char *buf;
|
||||
cfg_t *cfg_colors;
|
||||
int phys_screen = get_phys_screen(statusbar->screen);
|
||||
|
||||
w = p_new(Widget, 1);
|
||||
|
@ -277,25 +278,17 @@ tasklist_new(Statusbar *statusbar, cfg_t *config)
|
|||
w->alignment = AlignFlex;
|
||||
w->data = d = p_new(Data, 1);
|
||||
|
||||
if((buf = cfg_getstr(config, "fg")))
|
||||
draw_color_new(globalconf.display, phys_screen, buf, &d->colors.normal.fg);
|
||||
else
|
||||
d->colors.normal.fg = globalconf.screens[statusbar->screen].colors.normal.fg;
|
||||
cfg_colors = cfg_getsec(config, "colors");
|
||||
|
||||
if((buf = cfg_getstr(config, "bg")))
|
||||
draw_color_new(globalconf.display, phys_screen, buf, &d->colors.normal.bg);
|
||||
else
|
||||
d->colors.normal.bg = globalconf.screens[statusbar->screen].colors.normal.bg;
|
||||
draw_colors_ctx_init(globalconf.display, phys_screen,
|
||||
cfg_getsec(cfg_colors, "normal"),
|
||||
&d->colors.normal,
|
||||
&globalconf.screens[statusbar->screen].colors.normal);
|
||||
|
||||
if((buf = cfg_getstr(config, "focus_bg")))
|
||||
draw_color_new(globalconf.display, phys_screen, buf, &d->colors.focus.bg);
|
||||
else
|
||||
d->colors.focus.bg = globalconf.screens[statusbar->screen].colors.focus.bg;
|
||||
|
||||
if((buf = cfg_getstr(config, "focus_fg")))
|
||||
draw_color_new(globalconf.display, phys_screen, buf, &d->colors.focus.fg);
|
||||
else
|
||||
d->colors.focus.fg = globalconf.screens[statusbar->screen].colors.focus.fg;
|
||||
draw_colors_ctx_init(globalconf.display, phys_screen,
|
||||
cfg_getsec(cfg_colors, "focus"),
|
||||
&d->colors.focus,
|
||||
&globalconf.screens[statusbar->screen].colors.focus);
|
||||
|
||||
d->align = draw_get_align(cfg_getstr(config, "text_align"));
|
||||
d->show_icons = cfg_getbool(config, "show_icons");
|
||||
|
|
|
@ -114,6 +114,7 @@ textbox_new(Statusbar *statusbar, cfg_t *config)
|
|||
Widget *w;
|
||||
Data *d;
|
||||
char *buf;
|
||||
int phys_screen = get_phys_screen(statusbar->screen);
|
||||
|
||||
w = p_new(Widget, 1);
|
||||
widget_common_new(w, statusbar, config);
|
||||
|
@ -123,21 +124,16 @@ textbox_new(Statusbar *statusbar, cfg_t *config)
|
|||
|
||||
w->data = d = p_new(Data, 1);
|
||||
|
||||
if((buf = cfg_getstr(config, "fg")))
|
||||
draw_color_new(globalconf.display, get_phys_screen(statusbar->screen), buf, &d->colors.fg);
|
||||
else
|
||||
d->colors.fg = globalconf.screens[statusbar->screen].colors.normal.fg;
|
||||
|
||||
if((buf = cfg_getstr(config, "bg")))
|
||||
draw_color_new(globalconf.display, get_phys_screen(statusbar->screen), buf, &d->colors.bg);
|
||||
else
|
||||
d->colors.bg = globalconf.screens[statusbar->screen].colors.normal.bg;
|
||||
draw_colors_ctx_init(globalconf.display, phys_screen,
|
||||
cfg_getsec(config, "colors"),
|
||||
&d->colors,
|
||||
&globalconf.screens[statusbar->screen].colors.normal);
|
||||
|
||||
d->width = cfg_getint(config, "width");
|
||||
d->align = draw_get_align(cfg_getstr(config, "text_align"));
|
||||
|
||||
if((buf = cfg_getstr(config, "font")))
|
||||
w->font = XftFontOpenName(globalconf.display, get_phys_screen(statusbar->screen), buf);
|
||||
w->font = XftFontOpenName(globalconf.display, phys_screen, buf);
|
||||
|
||||
if(!w->font)
|
||||
w->font = globalconf.screens[statusbar->screen].font;
|
||||
|
|
Loading…
Reference in New Issue