Commit ece8eb5e authored by Tinu Weber's avatar Tinu Weber

statusbar: Use statusbar colours from config; use `focused` state

parent e2f7db1f
......@@ -78,7 +78,12 @@ bstack_apply(struct layout *l, struct rectangle *area)
static void
init_icon(struct layout *l)
{
struct config const *config = config_get();
uint64_t *icon_lines;
uint32_t fg_focused = config->bar.focused.foreground.colour;
uint32_t bg_focused = config->bar.focused.background.colour;
uint32_t fg_unfocused = config->bar.unfocused.foreground.colour;
uint32_t bg_unfocused = config->bar.unfocused.background.colour;
/* icons */
switch (l->type) {
......@@ -140,9 +145,9 @@ init_icon(struct layout *l)
};
break;
}
l->icon_active = icon_create(17, 15, 0xAFD700, 0x222222);
l->icon_active = icon_create(17, 15, fg_focused, bg_focused);
icon_draw(l->icon_active, icon_lines);
l->icon_inactive = icon_create(17, 15, 0x555555, 0x222222);
l->icon_inactive = icon_create(17, 15, fg_unfocused, bg_unfocused);
icon_draw(l->icon_inactive, icon_lines);
}
......
......@@ -67,11 +67,10 @@ statusbar_redraw(struct statusbar *bar)
struct monitor *mon = bar->monitor;
struct layout *l;
struct icon *i;
bool focused = mon->seat && mon == mon->seat->selmon;
uint32_t fg = focused ? config->bar.focused.foreground.colour
: config->bar.unfocused.foreground.colour;
uint32_t bg = focused ? config->bar.focused.background.colour
: config->bar.unfocused.background.colour;
uint32_t fg = bar->focused ? config->bar.focused.foreground.colour
: config->bar.unfocused.foreground.colour;
uint32_t bg = bar->focused ? config->bar.focused.background.colour
: config->bar.unfocused.background.colour;
if (bar->pos.x != mon->dim.x
|| bar->pos.y != mon->dim.y
......@@ -96,7 +95,7 @@ statusbar_redraw(struct statusbar *bar)
if (mon->selws) {
/* layout icon */
l = mon->selws->layout;
i = focused ? l->icon_active : l->icon_inactive;
i = bar->focused ? l->icon_active : l->icon_inactive;
XCopyArea(x11.dpy, i->pixmap, bar->pm, x11.gc,
0, 0, i->w, i->h, 2, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment