...
 
Commits (2)
...@@ -1504,15 +1504,17 @@ steplayout(union arg arg) ...@@ -1504,15 +1504,17 @@ steplayout(union arg arg)
void void
stepmon(union arg arg) stepmon(union arg arg)
{ {
struct monitor *m, *srcmon, *dstmon; struct monitor *srcmon, *dstmon;
unsigned int srcpos, dstpos; unsigned int srcpos, dstpos;
/* find index of source monitor */ /* find index of source monitor */
assert(seat->selmon); assert(seat->selmon);
srcmon = seat->selmon; srcmon = seat->selmon;
LIST_FOR (seat->monitors, srcpos, m) if (!srcmon) {
if (m == srcmon) warn("Seat does not focus any monitor");
break; return;
}
srcpos = list_find_index(seat->monitors, srcmon, NULL);
assert(srcpos < seat->monitors->size); assert(srcpos < seat->monitors->size);
/* find destination monitor */ /* find destination monitor */
......
...@@ -78,7 +78,12 @@ bstack_apply(struct layout *l, struct rectangle *area) ...@@ -78,7 +78,12 @@ bstack_apply(struct layout *l, struct rectangle *area)
static void static void
init_icon(struct layout *l) init_icon(struct layout *l)
{ {
struct config const *config = config_get();
uint64_t *icon_lines; 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 */ /* icons */
switch (l->type) { switch (l->type) {
...@@ -140,9 +145,9 @@ init_icon(struct layout *l) ...@@ -140,9 +145,9 @@ init_icon(struct layout *l)
}; };
break; 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); 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); icon_draw(l->icon_inactive, icon_lines);
} }
......
...@@ -91,17 +91,15 @@ monitor_focus(struct monitor *mon, bool focus) ...@@ -91,17 +91,15 @@ monitor_focus(struct monitor *mon, bool focus)
{ {
if (mon->focused == focus) if (mon->focused == focus)
return; return;
if (focus && !mon->seat)
die("Attempt to focus unattached monitor");
mon->focused = focus; mon->focused = focus;
if (mon->scratchpad)
if (mon->selws) workspace_focus(mon->scratchpad, focus);
else if (mon->selws)
workspace_focus(mon->selws, focus); workspace_focus(mon->selws, focus);
else if (focus) else if (focus)
XSetInputFocus(x11.dpy, x11.root, RevertToPointerRoot, XSetInputFocus(x11.dpy, x11.root, RevertToPointerRoot,
CurrentTime); CurrentTime);
statusbar_focus(mon->bar, focus); statusbar_focus(mon->bar, focus);
} }
......
...@@ -67,11 +67,10 @@ statusbar_redraw(struct statusbar *bar) ...@@ -67,11 +67,10 @@ statusbar_redraw(struct statusbar *bar)
struct monitor *mon = bar->monitor; struct monitor *mon = bar->monitor;
struct layout *l; struct layout *l;
struct icon *i; struct icon *i;
bool focused = mon->seat && mon == mon->seat->selmon; uint32_t fg = bar->focused ? config->bar.focused.foreground.colour
uint32_t fg = focused ? config->bar.focused.foreground.colour : config->bar.unfocused.foreground.colour;
: config->bar.unfocused.foreground.colour; uint32_t bg = bar->focused ? config->bar.focused.background.colour
uint32_t bg = focused ? config->bar.focused.background.colour : config->bar.unfocused.background.colour;
: config->bar.unfocused.background.colour;
if (bar->pos.x != mon->dim.x if (bar->pos.x != mon->dim.x
|| bar->pos.y != mon->dim.y || bar->pos.y != mon->dim.y
...@@ -96,7 +95,7 @@ statusbar_redraw(struct statusbar *bar) ...@@ -96,7 +95,7 @@ statusbar_redraw(struct statusbar *bar)
if (mon->selws) { if (mon->selws) {
/* layout icon */ /* layout icon */
l = mon->selws->layout; 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, XCopyArea(x11.dpy, i->pixmap, bar->pm, x11.gc,
0, 0, i->w, i->h, 2, 0); 0, 0, i->w, i->h, 2, 0);
......