Merge pull request #1733 from Airblader/feature-1732
Added a separate color directive for the binding mode indicator
This commit is contained in:
commit
6b505d8aca
18
docs/ipc
18
docs/ipc
|
@ -520,21 +520,23 @@ statusline::
|
||||||
Text color to be used for the statusline.
|
Text color to be used for the statusline.
|
||||||
separator::
|
separator::
|
||||||
Text color to be used for the separator.
|
Text color to be used for the separator.
|
||||||
focused_workspace_text/focused_workspace_bg::
|
focused_workspace_text/focused_workspace_bg/focused_workspace_border::
|
||||||
Text color/background color for a workspace button when the workspace
|
Text/background/border color for a workspace button when the workspace
|
||||||
has focus.
|
has focus.
|
||||||
active_workspace_text/active_workspace_bg::
|
active_workspace_text/active_workspace_bg/active_workspace_border::
|
||||||
Text color/background color for a workspace button when the workspace
|
Text/background/border color for a workspace button when the workspace
|
||||||
is active (visible) on some output, but the focus is on another one.
|
is active (visible) on some output, but the focus is on another one.
|
||||||
You can only tell this apart from the focused workspace when you are
|
You can only tell this apart from the focused workspace when you are
|
||||||
using multiple monitors.
|
using multiple monitors.
|
||||||
inactive_workspace_text/inactive_workspace_bg::
|
inactive_workspace_text/inactive_workspace_bg/inactive_workspace_border::
|
||||||
Text color/background color for a workspace button when the workspace
|
Text/background/border color for a workspace button when the workspace
|
||||||
does not have focus and is not active (visible) on any output. This
|
does not have focus and is not active (visible) on any output. This
|
||||||
will be the case for most workspaces.
|
will be the case for most workspaces.
|
||||||
urgent_workspace_text/urgent_workspace_bar::
|
urgent_workspace_text/urgent_workspace_bg/urgent_workspace_border::
|
||||||
Text color/background color for workspaces which contain at least one
|
Text/background/border color for workspaces which contain at least one
|
||||||
window with the urgency hint set.
|
window with the urgency hint set.
|
||||||
|
binding_mode_text/binding_mode_bg/binding_mode_border::
|
||||||
|
Text/background/border color for the binding mode indicator.
|
||||||
|
|
||||||
|
|
||||||
*Example of configured bars:*
|
*Example of configured bars:*
|
||||||
|
|
|
@ -1457,7 +1457,10 @@ inactive_workspace::
|
||||||
will be the case for most workspaces.
|
will be the case for most workspaces.
|
||||||
urgent_workspace::
|
urgent_workspace::
|
||||||
Border, background and text color for a workspace button when the workspace
|
Border, background and text color for a workspace button when the workspace
|
||||||
contains a window with the urgency hint set. Also applies to +mode+ indicators.
|
contains a window with the urgency hint set.
|
||||||
|
binding_mode::
|
||||||
|
Border, background and text color for the binding mode indicator. If not used,
|
||||||
|
the colors will be taken from +urgent_workspace+.
|
||||||
|
|
||||||
*Syntax*:
|
*Syntax*:
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
|
@ -1482,6 +1485,7 @@ bar {
|
||||||
active_workspace #333333 #5f676a #ffffff
|
active_workspace #333333 #5f676a #ffffff
|
||||||
inactive_workspace #333333 #222222 #888888
|
inactive_workspace #333333 #222222 #888888
|
||||||
urgent_workspace #2f343a #900000 #ffffff
|
urgent_workspace #2f343a #900000 #ffffff
|
||||||
|
binding_mode #2f343a #900000 #ffffff
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
|
|
|
@ -40,6 +40,9 @@ struct xcb_color_strings_t {
|
||||||
char *urgent_ws_bg;
|
char *urgent_ws_bg;
|
||||||
char *urgent_ws_fg;
|
char *urgent_ws_fg;
|
||||||
char *urgent_ws_border;
|
char *urgent_ws_border;
|
||||||
|
char *binding_mode_bg;
|
||||||
|
char *binding_mode_fg;
|
||||||
|
char *binding_mode_border;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct xcb_colors_t xcb_colors_t;
|
typedef struct xcb_colors_t xcb_colors_t;
|
||||||
|
|
|
@ -191,6 +191,9 @@ static int config_string_cb(void *params_, const unsigned char *val, size_t _len
|
||||||
COLOR(urgent_workspace_border, urgent_ws_border);
|
COLOR(urgent_workspace_border, urgent_ws_border);
|
||||||
COLOR(urgent_workspace_bg, urgent_ws_bg);
|
COLOR(urgent_workspace_bg, urgent_ws_bg);
|
||||||
COLOR(urgent_workspace_text, urgent_ws_fg);
|
COLOR(urgent_workspace_text, urgent_ws_fg);
|
||||||
|
COLOR(binding_mode_border, binding_mode_border);
|
||||||
|
COLOR(binding_mode_bg, binding_mode_bg);
|
||||||
|
COLOR(binding_mode_text, binding_mode_fg);
|
||||||
|
|
||||||
printf("got unexpected string %.*s for cur_key = %s\n", len, val, cur_key);
|
printf("got unexpected string %.*s for cur_key = %s\n", len, val, cur_key);
|
||||||
|
|
||||||
|
@ -286,5 +289,8 @@ void free_colors(struct xcb_color_strings_t *colors) {
|
||||||
FREE_COLOR(focus_ws_fg);
|
FREE_COLOR(focus_ws_fg);
|
||||||
FREE_COLOR(focus_ws_bg);
|
FREE_COLOR(focus_ws_bg);
|
||||||
FREE_COLOR(focus_ws_border);
|
FREE_COLOR(focus_ws_border);
|
||||||
|
FREE_COLOR(binding_mode_fg);
|
||||||
|
FREE_COLOR(binding_mode_bg);
|
||||||
|
FREE_COLOR(binding_mode_border);
|
||||||
#undef FREE_COLOR
|
#undef FREE_COLOR
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,9 @@ struct xcb_colors_t {
|
||||||
uint32_t focus_ws_bg;
|
uint32_t focus_ws_bg;
|
||||||
uint32_t focus_ws_fg;
|
uint32_t focus_ws_fg;
|
||||||
uint32_t focus_ws_border;
|
uint32_t focus_ws_border;
|
||||||
|
uint32_t binding_mode_bg;
|
||||||
|
uint32_t binding_mode_fg;
|
||||||
|
uint32_t binding_mode_border;
|
||||||
};
|
};
|
||||||
struct xcb_colors_t colors;
|
struct xcb_colors_t colors;
|
||||||
|
|
||||||
|
@ -374,6 +377,18 @@ void init_colors(const struct xcb_color_strings_t *new_colors) {
|
||||||
PARSE_COLOR(focus_ws_border, "#4c7899");
|
PARSE_COLOR(focus_ws_border, "#4c7899");
|
||||||
#undef PARSE_COLOR
|
#undef PARSE_COLOR
|
||||||
|
|
||||||
|
#define PARSE_COLOR_FALLBACK(name, fallback) \
|
||||||
|
do { \
|
||||||
|
colors.name = new_colors->name ? get_colorpixel(new_colors->name) : colors.fallback; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/* For the binding mode indicator colors, we don't hardcode a default.
|
||||||
|
* Instead, we fall back to urgent_ws_* colors. */
|
||||||
|
PARSE_COLOR_FALLBACK(binding_mode_fg, urgent_ws_fg);
|
||||||
|
PARSE_COLOR_FALLBACK(binding_mode_bg, urgent_ws_bg);
|
||||||
|
PARSE_COLOR_FALLBACK(binding_mode_border, urgent_ws_border);
|
||||||
|
#undef PARSE_COLOR_FALLBACK
|
||||||
|
|
||||||
init_tray_colors();
|
init_tray_colors();
|
||||||
xcb_flush(xcb_connection);
|
xcb_flush(xcb_connection);
|
||||||
}
|
}
|
||||||
|
@ -1897,11 +1912,11 @@ void draw_bars(bool unhide) {
|
||||||
if (binding.name && !config.disable_binding_mode_indicator) {
|
if (binding.name && !config.disable_binding_mode_indicator) {
|
||||||
workspace_width += logical_px(ws_spacing_px);
|
workspace_width += logical_px(ws_spacing_px);
|
||||||
|
|
||||||
uint32_t fg_color = colors.urgent_ws_fg;
|
uint32_t fg_color = colors.binding_mode_fg;
|
||||||
uint32_t bg_color = colors.urgent_ws_bg;
|
uint32_t bg_color = colors.binding_mode_bg;
|
||||||
uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND;
|
uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND;
|
||||||
|
|
||||||
uint32_t vals_border[] = {colors.urgent_ws_border, colors.urgent_ws_border};
|
uint32_t vals_border[] = {colors.binding_mode_border, colors.binding_mode_border};
|
||||||
xcb_change_gc(xcb_connection,
|
xcb_change_gc(xcb_connection,
|
||||||
outputs_walk->bargc,
|
outputs_walk->bargc,
|
||||||
mask,
|
mask,
|
||||||
|
|
|
@ -344,6 +344,10 @@ struct Barconfig {
|
||||||
char *urgent_workspace_border;
|
char *urgent_workspace_border;
|
||||||
char *urgent_workspace_bg;
|
char *urgent_workspace_bg;
|
||||||
char *urgent_workspace_text;
|
char *urgent_workspace_text;
|
||||||
|
|
||||||
|
char *binding_mode_border;
|
||||||
|
char *binding_mode_bg;
|
||||||
|
char *binding_mode_text;
|
||||||
} colors;
|
} colors;
|
||||||
|
|
||||||
TAILQ_ENTRY(Barconfig) configs;
|
TAILQ_ENTRY(Barconfig) configs;
|
||||||
|
|
|
@ -511,7 +511,7 @@ state BAR_COLORS:
|
||||||
'set' -> BAR_COLORS_IGNORE_LINE
|
'set' -> BAR_COLORS_IGNORE_LINE
|
||||||
colorclass = 'background', 'statusline', 'separator'
|
colorclass = 'background', 'statusline', 'separator'
|
||||||
-> BAR_COLORS_SINGLE
|
-> BAR_COLORS_SINGLE
|
||||||
colorclass = 'focused_workspace', 'active_workspace', 'inactive_workspace', 'urgent_workspace'
|
colorclass = 'focused_workspace', 'active_workspace', 'inactive_workspace', 'urgent_workspace', 'binding_mode'
|
||||||
-> BAR_COLORS_BORDER
|
-> BAR_COLORS_BORDER
|
||||||
'}'
|
'}'
|
||||||
-> BAR
|
-> BAR
|
||||||
|
|
|
@ -130,6 +130,9 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath,
|
||||||
FREE(barconfig->colors.urgent_workspace_border);
|
FREE(barconfig->colors.urgent_workspace_border);
|
||||||
FREE(barconfig->colors.urgent_workspace_bg);
|
FREE(barconfig->colors.urgent_workspace_bg);
|
||||||
FREE(barconfig->colors.urgent_workspace_text);
|
FREE(barconfig->colors.urgent_workspace_text);
|
||||||
|
FREE(barconfig->colors.binding_mode_border);
|
||||||
|
FREE(barconfig->colors.binding_mode_bg);
|
||||||
|
FREE(barconfig->colors.binding_mode_text);
|
||||||
TAILQ_REMOVE(&barconfigs, barconfig, configs);
|
TAILQ_REMOVE(&barconfigs, barconfig, configs);
|
||||||
FREE(barconfig);
|
FREE(barconfig);
|
||||||
}
|
}
|
||||||
|
|
|
@ -570,6 +570,7 @@ CFGFUN(bar_color, const char *colorclass, const char *border, const char *backgr
|
||||||
APPLY_COLORS(active_workspace);
|
APPLY_COLORS(active_workspace);
|
||||||
APPLY_COLORS(inactive_workspace);
|
APPLY_COLORS(inactive_workspace);
|
||||||
APPLY_COLORS(urgent_workspace);
|
APPLY_COLORS(urgent_workspace);
|
||||||
|
APPLY_COLORS(binding_mode);
|
||||||
|
|
||||||
#undef APPLY_COLORS
|
#undef APPLY_COLORS
|
||||||
}
|
}
|
||||||
|
|
|
@ -611,6 +611,9 @@ static void dump_bar_config(yajl_gen gen, Barconfig *config) {
|
||||||
YSTR_IF_SET(urgent_workspace_border);
|
YSTR_IF_SET(urgent_workspace_border);
|
||||||
YSTR_IF_SET(urgent_workspace_bg);
|
YSTR_IF_SET(urgent_workspace_bg);
|
||||||
YSTR_IF_SET(urgent_workspace_text);
|
YSTR_IF_SET(urgent_workspace_text);
|
||||||
|
YSTR_IF_SET(binding_mode_border);
|
||||||
|
YSTR_IF_SET(binding_mode_bg);
|
||||||
|
YSTR_IF_SET(binding_mode_text);
|
||||||
y(map_close);
|
y(map_close);
|
||||||
|
|
||||||
y(map_close);
|
y(map_close);
|
||||||
|
|
|
@ -112,6 +112,7 @@ bar {
|
||||||
active_workspace #333333 #222222 #888888
|
active_workspace #333333 #222222 #888888
|
||||||
inactive_workspace #333333 #222222 #888888
|
inactive_workspace #333333 #222222 #888888
|
||||||
urgent_workspace #2f343a #900000 #ffffff
|
urgent_workspace #2f343a #900000 #ffffff
|
||||||
|
binding_mode #abc123 #123abc #ababab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOT
|
EOT
|
||||||
|
@ -151,6 +152,9 @@ is_deeply($bar_config->{colors},
|
||||||
urgent_workspace_border => '#2f343a',
|
urgent_workspace_border => '#2f343a',
|
||||||
urgent_workspace_text => '#ffffff',
|
urgent_workspace_text => '#ffffff',
|
||||||
urgent_workspace_bg => '#900000',
|
urgent_workspace_bg => '#900000',
|
||||||
|
binding_mode_border => '#abc123',
|
||||||
|
binding_mode_text => '#ababab',
|
||||||
|
binding_mode_bg => '#123abc',
|
||||||
}, 'colors ok');
|
}, 'colors ok');
|
||||||
|
|
||||||
exit_gracefully($pid);
|
exit_gracefully($pid);
|
||||||
|
|
Loading…
Reference in New Issue