none::
The window will neither be focused, nor be marked urgent.
+=== Drawing marks on window decoration
+
+If activated, marks on windows are drawn in their window decoration. However,
+any mark starting with an underscore in its name (+_+) will not be drawn even if
+this option is activated.
+
+The default for this option is +yes+.
+
+*Syntax*:
+-------------------
+show_marks [yes|no]
+-------------------
+
+*Example*:
+--------------
+show_marks yes
+--------------
+
== Configuring i3bar
The bar at the bottom of your monitor is drawn by a separate process called
this mark, add it if the window has none or replace the current mark if it has
another mark.
+Refer to +show_marks+ if you don't want marks to be shown in the window decoration.
+
*Syntax*:
------------------------------
mark [--toggle] identifier
FOWA_NONE
} focus_on_window_activation;
+ /** Specifies whether or not marks should be displayed in the window
+ * decoration. Marks starting with a "_" will be ignored either way. */
+ bool show_marks;
+
/** The default border style for new windows. */
border_style_t default_border;
CFGFUN(fake_outputs, const char *outputs);
CFGFUN(force_display_urgency_hint, const long duration_ms);
CFGFUN(focus_on_window_activation, const char *mode);
+CFGFUN(show_marks, const char *value);
CFGFUN(hide_edge_borders, const char *borders);
CFGFUN(assign, const char *workspace);
CFGFUN(ipc_socket, const char *path);
/* user-definable mark to jump to this container later */
char *mark;
+ /* cached to decide whether a redraw is needed */
+ bool mark_changed;
double percent;
'fake_outputs', 'fake-outputs' -> FAKE_OUTPUTS
'force_display_urgency_hint' -> FORCE_DISPLAY_URGENCY_HINT
'focus_on_window_activation' -> FOCUS_ON_WINDOW_ACTIVATION
+ 'show_marks' -> SHOW_MARKS
'workspace' -> WORKSPACE
'ipc_socket', 'ipc-socket' -> IPC_SOCKET
'restart_state' -> RESTART_STATE
duration_ms = number
-> FORCE_DISPLAY_URGENCY_HINT_MS
+# show_marks
+state SHOW_MARKS:
+ value = word
+ -> call cfg_show_marks($value)
+
state FORCE_DISPLAY_URGENCY_HINT_MS:
'ms'
->
owindow *current;
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
+ current->con->mark_changed = true;
if (toggle != NULL && current->con->mark && strcmp(current->con->mark, mark) == 0) {
DLOG("removing window mark %s\n", mark);
FREE(current->con->mark);
if (matched)
continue;
- if (con->mark && strcmp(con->mark, mark) == 0)
+ if (con->mark && strcmp(con->mark, mark) == 0) {
FREE(con->mark);
+ con->mark_changed = true;
+ }
}
cmd_output->needs_tree_render = true;
if (mark == NULL) {
Con *con;
TAILQ_FOREACH(con, &all_cons, all_cons) {
+ if (con->mark == NULL)
+ continue;
+
FREE(con->mark);
+ con->mark_changed = true;
}
DLOG("removed all window marks");
} else {
Con *con;
TAILQ_FOREACH(con, &all_cons, all_cons) {
- if (con->mark && strcmp(con->mark, mark) == 0)
+ if (con->mark && strcmp(con->mark, mark) == 0) {
FREE(con->mark);
+ con->mark_changed = true;
+ }
}
DLOG("removed window mark %s\n", mark);
}
INIT_COLOR(config.bar.unfocused, "#333333", "#222222", "#888888", "#000000");
INIT_COLOR(config.bar.urgent, "#2f343a", "#900000", "#ffffff", "#000000");
+ config.show_marks = true;
+
config.default_border = BS_NORMAL;
config.default_floating_border = BS_NORMAL;
config.default_border_width = logical_px(2);
DLOG("Set new focus_on_window_activation mode = %i", config.focus_on_window_activation);
}
+CFGFUN(show_marks, const char *value) {
+ config.show_marks = eval_boolstr(value);
+}
+
CFGFUN(workspace, const char *workspace, const char *output) {
DLOG("Assigning workspace \"%s\" to output \"%s\"\n", workspace, output);
/* Check for earlier assignments of the same workspace so that we
(con->window == NULL || !con->window->name_x_changed) &&
!parent->pixmap_recreated &&
!con->pixmap_recreated &&
+ !con->mark_changed &&
memcmp(p, con->deco_render_params, sizeof(struct deco_render_params)) == 0) {
free(p);
goto copy_pixmaps;
parent->pixmap_recreated = false;
con->pixmap_recreated = false;
+ con->mark_changed = false;
/* 2: draw the client.background, but only for the parts around the client_rect */
if (con->window != NULL) {
//DLOG("indent_level = %d, indent_mult = %d\n", indent_level, indent_mult);
int indent_px = (indent_level * 5) * indent_mult;
+ int mark_width = 0;
+ if (config.show_marks && con->mark != NULL && (con->mark)[0] != '_') {
+ char *formatted_mark;
+ sasprintf(&formatted_mark, "[%s]", con->mark);
+ i3String *mark = i3string_from_utf8(formatted_mark);
+ FREE(formatted_mark);
+ mark_width = predict_text_width(mark);
+
+ draw_text(mark, parent->pixmap, parent->pm_gc,
+ con->deco_rect.x + con->deco_rect.width - mark_width - logical_px(2),
+ con->deco_rect.y + text_offset_y, mark_width);
+
+ I3STRING_FREE(mark);
+ }
+
draw_text(win->name,
parent->pixmap, parent->pm_gc,
- con->deco_rect.x + 2 + indent_px, con->deco_rect.y + text_offset_y,
- con->deco_rect.width - 2 - indent_px);
+ con->deco_rect.x + logical_px(2) + indent_px, con->deco_rect.y + text_offset_y,
+ con->deco_rect.width - logical_px(2) - indent_px - mark_width - logical_px(2));
after_title:
/* Since we don’t clip the text at all, it might in some cases be painted
EOT
my $expected_all_tokens = <<'EOT';
-ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'bindsym', 'bindcode', 'bind', 'bar', 'font', 'mode', 'floating_minimum_size', 'floating_maximum_size', 'floating_modifier', 'default_orientation', 'workspace_layout', 'new_window', 'new_float', 'hide_edge_borders', 'for_window', 'assign', 'focus_follows_mouse', 'mouse_warping', 'force_focus_wrapping', 'force_xinerama', 'force-xinerama', 'workspace_auto_back_and_forth', 'fake_outputs', 'fake-outputs', 'force_display_urgency_hint', 'focus_on_window_activation', 'workspace', 'ipc_socket', 'ipc-socket', 'restart_state', 'popup_during_fullscreen', 'exec_always', 'exec', 'client.background', 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent', 'client.placeholder'
+ERROR: CONFIG: Expected one of these tokens: <end>, '#', 'set', 'bindsym', 'bindcode', 'bind', 'bar', 'font', 'mode', 'floating_minimum_size', 'floating_maximum_size', 'floating_modifier', 'default_orientation', 'workspace_layout', 'new_window', 'new_float', 'hide_edge_borders', 'for_window', 'assign', 'focus_follows_mouse', 'mouse_warping', 'force_focus_wrapping', 'force_xinerama', 'force-xinerama', 'workspace_auto_back_and_forth', 'fake_outputs', 'fake-outputs', 'force_display_urgency_hint', 'focus_on_window_activation', 'show_marks', 'workspace', 'ipc_socket', 'ipc-socket', 'restart_state', 'popup_during_fullscreen', 'exec_always', 'exec', 'client.background', 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent', 'client.placeholder'
EOT
my $expected_end = <<'EOT';