Make show_marks configurable

Introduce a config directive "show_marks [yes|no]" to en- or disable drawing marks on window decorations.
To not change the look & feel of existing configurations, the default is "no".
This commit is contained in:
Ingo Bürk
2015-03-29 00:26:49 +01:00
parent 2af1a80028
commit 245a29e233
7 changed files with 41 additions and 6 deletions

View File

@ -346,6 +346,10 @@ CFGFUN(focus_on_window_activation, const char *mode) {
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

10
src/x.c
View File

@ -534,16 +534,16 @@ void x_draw_decoration(Con *con) {
int indent_px = (indent_level * 5) * indent_mult;
int mark_width = 0;
if (con->mark != NULL && (con->mark)[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) + logical_px(2);
mark_width = predict_text_width(mark);
draw_text(mark, parent->pixmap, parent->pm_gc,
con->deco_rect.x + con->deco_rect.width - mark_width,
con->deco_rect.y + text_offset_y, mark_width - logical_px(2));
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);
}
@ -551,7 +551,7 @@ void x_draw_decoration(Con *con) {
draw_text(win->name,
parent->pixmap, parent->pm_gc,
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);
con->deco_rect.width - logical_px(2) - indent_px - mark_width - logical_px(2));
after_title:
/* Since we dont clip the text at all, it might in some cases be painted