The font to use for text on the bar.
workspace_buttons (boolean)::
Display workspace buttons or not? Defaults to true.
+binding_mode_indicator (boolean)::
+ Display the mode indicator or not? Defaults to true.
verbose (boolean)::
Should the bar enable verbose output for debugging? Defaults to false.
colors (map)::
"status_command": "i3status",
"font": "-misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1",
"workspace_buttons": true,
+ "binding_mode_indicator": true,
"verbose": false,
"colors": {
"background": "#c0c0c0",
--------------------------
*Example*:
---------------------
+------------------------
bar {
workspace_buttons no
}
---------------------
+------------------------
+
+=== Binding Mode indicator
+
+Specifies whether the current binding mode indicator should be shown or not.
+This is useful if you want to hide the workspace buttons but still be able
+to see the current binding mode indicator.
+For an example of a +mode+ definition, see <<resizingconfig>>.
+
+The default is to show the mode indicator.
+
+*Syntax*:
+-------------------------------
+binding_mode_indicator <yes|no>
+-------------------------------
+
+*Example*:
+-----------------------------
+bar {
+ binding_mode_indicator no
+}
+-----------------------------
=== Colors
position_t position;
int verbose;
struct xcb_color_strings_t colors;
- int disable_ws;
+ bool disable_binding_mode_indicator;
+ bool disable_ws;
char *bar_id;
char *command;
char *fontname;
*
*/
static int config_boolean_cb(void *params_, int val) {
+ if (!strcmp(cur_key, "binding_mode_indicator")) {
+ DLOG("binding_mode_indicator = %d\n", val);
+ config.disable_binding_mode_indicator = !val;
+ return 1;
+ }
+
if (!strcmp(cur_key, "workspace_buttons")) {
DLOG("workspace_buttons = %d\n", val);
config.disable_ws = !val;
MIN(outputs_walk->rect.w - traypx - 4, statusline_width), font.height + 2);
}
- if (config.disable_ws) {
- continue;
- }
-
- i3_ws *ws_walk;
-
- TAILQ_FOREACH(ws_walk, outputs_walk->workspaces, tailq) {
- DLOG("Drawing Button for WS %s at x = %d, len = %d\n", i3string_as_utf8(ws_walk->name), i, ws_walk->name_width);
- uint32_t fg_color = colors.inactive_ws_fg;
- uint32_t bg_color = colors.inactive_ws_bg;
- uint32_t border_color = colors.inactive_ws_border;
- if (ws_walk->visible) {
- if (!ws_walk->focused) {
- fg_color = colors.active_ws_fg;
- bg_color = colors.active_ws_bg;
- border_color = colors.active_ws_border;
- } else {
- fg_color = colors.focus_ws_fg;
- bg_color = colors.focus_ws_bg;
- border_color = colors.focus_ws_border;
- if (last_urgent_ws && strcmp(i3string_as_utf8(ws_walk->name), last_urgent_ws) == 0)
- walks_away = false;
+ if (!config.disable_ws) {
+ i3_ws *ws_walk;
+ TAILQ_FOREACH(ws_walk, outputs_walk->workspaces, tailq) {
+ DLOG("Drawing Button for WS %s at x = %d, len = %d\n",
+ i3string_as_utf8(ws_walk->name), i, ws_walk->name_width);
+ uint32_t fg_color = colors.inactive_ws_fg;
+ uint32_t bg_color = colors.inactive_ws_bg;
+ uint32_t border_color = colors.inactive_ws_border;
+ if (ws_walk->visible) {
+ if (!ws_walk->focused) {
+ fg_color = colors.active_ws_fg;
+ bg_color = colors.active_ws_bg;
+ border_color = colors.active_ws_border;
+ } else {
+ fg_color = colors.focus_ws_fg;
+ bg_color = colors.focus_ws_bg;
+ border_color = colors.focus_ws_border;
+ if (last_urgent_ws && strcmp(i3string_as_utf8(ws_walk->name),
+ last_urgent_ws) == 0)
+ walks_away = false;
+ }
}
- }
- if (ws_walk->urgent) {
- DLOG("WS %s is urgent!\n", i3string_as_utf8(ws_walk->name));
- fg_color = colors.urgent_ws_fg;
- bg_color = colors.urgent_ws_bg;
- border_color = colors.urgent_ws_border;
- unhide = true;
- if (!ws_walk->focused) {
- FREE(last_urgent_ws);
- last_urgent_ws = sstrdup(i3string_as_utf8(ws_walk->name));
+ if (ws_walk->urgent) {
+ DLOG("WS %s is urgent!\n", i3string_as_utf8(ws_walk->name));
+ fg_color = colors.urgent_ws_fg;
+ bg_color = colors.urgent_ws_bg;
+ border_color = colors.urgent_ws_border;
+ unhide = true;
+ if (!ws_walk->focused) {
+ FREE(last_urgent_ws);
+ last_urgent_ws = sstrdup(i3string_as_utf8(ws_walk->name));
+ }
}
- }
- uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND;
- uint32_t vals_border[] = { border_color, border_color };
- xcb_change_gc(xcb_connection,
- outputs_walk->bargc,
- mask,
- vals_border);
- xcb_rectangle_t rect_border = { i, 1, ws_walk->name_width + 10, font.height + 4 };
- xcb_poly_fill_rectangle(xcb_connection,
- outputs_walk->buffer,
- outputs_walk->bargc,
- 1,
- &rect_border);
- uint32_t vals[] = { bg_color, bg_color };
- xcb_change_gc(xcb_connection,
- outputs_walk->bargc,
- mask,
- vals);
- xcb_rectangle_t rect = { i + 1, 2, ws_walk->name_width + 8, font.height + 2 };
- xcb_poly_fill_rectangle(xcb_connection,
- outputs_walk->buffer,
- outputs_walk->bargc,
- 1,
- &rect);
- set_font_colors(outputs_walk->bargc, fg_color, bg_color);
- draw_text(ws_walk->name, outputs_walk->buffer, outputs_walk->bargc, i + 5, 3, ws_walk->name_width);
- i += 10 + ws_walk->name_width + 1;
+ uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND;
+ uint32_t vals_border[] = { border_color, border_color };
+ xcb_change_gc(xcb_connection,
+ outputs_walk->bargc,
+ mask,
+ vals_border);
+ xcb_rectangle_t rect_border = { i, 1, ws_walk->name_width + 10, font.height + 4 };
+ xcb_poly_fill_rectangle(xcb_connection,
+ outputs_walk->buffer,
+ outputs_walk->bargc,
+ 1,
+ &rect_border);
+ uint32_t vals[] = { bg_color, bg_color };
+ xcb_change_gc(xcb_connection,
+ outputs_walk->bargc,
+ mask,
+ vals);
+ xcb_rectangle_t rect = { i + 1, 2, ws_walk->name_width + 8, font.height + 2 };
+ xcb_poly_fill_rectangle(xcb_connection,
+ outputs_walk->buffer,
+ outputs_walk->bargc,
+ 1,
+ &rect);
+ set_font_colors(outputs_walk->bargc, fg_color, bg_color);
+ draw_text(ws_walk->name, outputs_walk->buffer, outputs_walk->bargc,
+ i + 5, 3, ws_walk->name_width);
+ i += 10 + ws_walk->name_width + 1;
+ }
}
- if (binding.name) {
-
+ if (binding.name && !config.disable_binding_mode_indicator) {
uint32_t fg_color = colors.urgent_ws_fg;
uint32_t bg_color = colors.urgent_ws_bg;
uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND;
* zero. */
bool hide_workspace_buttons;
+ /** Hide mode button? Configuration option is 'binding_mode_indicator no'
+ * but we invert the bool for the same reason as hide_workspace_buttons.*/
+ bool hide_binding_mode_indicator;
+
/** Enable verbose mode? Useful for debugging purposes. */
bool verbose;
CFGFUN(bar_tray_output, const char *output);
CFGFUN(bar_color_single, const char *colorclass, const char *color);
CFGFUN(bar_status_command, const char *command);
+CFGFUN(bar_binding_mode_indicator, const char *value);
CFGFUN(bar_workspace_buttons, const char *value);
CFGFUN(bar_finish);
error ->
'#' -> BAR_IGNORE_LINE
'set' -> BAR_IGNORE_LINE
- 'i3bar_command' -> BAR_BAR_COMMAND
- 'status_command' -> BAR_STATUS_COMMAND
- 'socket_path' -> BAR_SOCKET_PATH
- 'mode' -> BAR_MODE
- 'hidden_state' -> BAR_HIDDEN_STATE
- 'id' -> BAR_ID
- 'modifier' -> BAR_MODIFIER
- 'position' -> BAR_POSITION
- 'output' -> BAR_OUTPUT
- 'tray_output' -> BAR_TRAY_OUTPUT
- 'font' -> BAR_FONT
- 'workspace_buttons' -> BAR_WORKSPACE_BUTTONS
- 'verbose' -> BAR_VERBOSE
- 'colors' -> BAR_COLORS_BRACE
+ 'i3bar_command' -> BAR_BAR_COMMAND
+ 'status_command' -> BAR_STATUS_COMMAND
+ 'socket_path' -> BAR_SOCKET_PATH
+ 'mode' -> BAR_MODE
+ 'hidden_state' -> BAR_HIDDEN_STATE
+ 'id' -> BAR_ID
+ 'modifier' -> BAR_MODIFIER
+ 'position' -> BAR_POSITION
+ 'output' -> BAR_OUTPUT
+ 'tray_output' -> BAR_TRAY_OUTPUT
+ 'font' -> BAR_FONT
+ 'binding_mode_indicator' -> BAR_BINDING_MODE_INDICATOR
+ 'workspace_buttons' -> BAR_WORKSPACE_BUTTONS
+ 'verbose' -> BAR_VERBOSE
+ 'colors' -> BAR_COLORS_BRACE
'}'
-> call cfg_bar_finish(); INITIAL
font = string
-> call cfg_bar_font($font); BAR
+state BAR_BINDING_MODE_INDICATOR:
+ value = word
+ -> call cfg_bar_binding_mode_indicator($value); BAR
+
state BAR_WORKSPACE_BUTTONS:
value = word
-> call cfg_bar_workspace_buttons($value); BAR
current_bar.status_command = sstrdup(command);
}
+CFGFUN(bar_binding_mode_indicator, const char *value) {
+ current_bar.hide_binding_mode_indicator = !eval_boolstr(value);
+}
+
CFGFUN(bar_workspace_buttons, const char *value) {
current_bar.hide_workspace_buttons = !eval_boolstr(value);
}
ystr("workspace_buttons");
y(bool, !config->hide_workspace_buttons);
+ ystr("binding_mode_indicator");
+ y(bool, !config->hide_binding_mode_indicator);
+
ystr("verbose");
y(bool, config->verbose);
is($bar_config->{status_command}, 'i3status --foo', 'status_command correct');
ok(!$bar_config->{verbose}, 'verbose off by default');
ok($bar_config->{workspace_buttons}, 'workspace buttons enabled per default');
+ok($bar_config->{binding_mode_indicator}, 'mode indicator enabled per default');
is($bar_config->{mode}, 'dock', 'dock mode by default');
is($bar_config->{position}, 'bottom', 'position bottom by default');
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
bar {
- # Start a default instance of i3bar which provides workspace buttons.
+ # Start a default instance of i3bar which does not provide
+ # workspace buttons.
# Additionally, i3status will provide a statusline.
status_command i3status --bar
mode dock
font Terminus
workspace_buttons no
+ binding_mode_indicator no
verbose yes
socket_path /tmp/foobar
is($bar_config->{status_command}, 'i3status --bar', 'status_command correct');
ok($bar_config->{verbose}, 'verbose on');
ok(!$bar_config->{workspace_buttons}, 'workspace buttons disabled');
+ok(!$bar_config->{binding_mode_indicator}, 'mode indicator disabled');
is($bar_config->{mode}, 'dock', 'dock mode');
is($bar_config->{position}, 'top', 'position top');
is_deeply($bar_config->{outputs}, [ 'HDMI1', 'HDMI2' ], 'outputs ok');
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
bar {
- # Start a default instance of i3bar which provides workspace buttons.
+ # Start a default instance of i3bar which does not provide
+ # workspace buttons.
# Additionally, i3status will provide a statusline.
status_command i3status --bar
mode dock
font Terminus
workspace_buttons no
+ binding_mode_indicator yes
verbose yes
socket_path /tmp/foobar
is($bar_config->{status_command}, 'i3status --bar', 'status_command correct');
ok($bar_config->{verbose}, 'verbose on');
ok(!$bar_config->{workspace_buttons}, 'workspace buttons disabled');
+ok($bar_config->{binding_mode_indicator}, 'mode indicator enabled');
is($bar_config->{mode}, 'dock', 'dock mode');
is($bar_config->{position}, 'top', 'position top');
is_deeply($bar_config->{outputs}, [ 'HDMI1', 'HDMI2' ], 'outputs ok');
$expected = <<'EOT';
cfg_bar_output(LVDS-1)
-ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'i3bar_command', 'status_command', 'socket_path', 'mode', 'hidden_state', 'id', 'modifier', 'position', 'output', 'tray_output', 'font', 'workspace_buttons', 'verbose', 'colors', '}'
+ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'i3bar_command', 'status_command', 'socket_path', 'mode', 'hidden_state', 'id', 'modifier', 'position', 'output', 'tray_output', 'font', 'binding_mode_indicator', 'workspace_buttons', 'verbose', 'colors', '}'
ERROR: CONFIG: (in file <stdin>)
ERROR: CONFIG: Line 1: bar {
ERROR: CONFIG: Line 2: output LVDS-1