diff --git a/README.md b/README.md index 2674d84..be73766 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ dwl -s 'dwlb -font "monospace:size=16"' Command options send instructions to existing instances of dwlb. All commands take at least one argument to specify a bar on which to operate. This may be zxdg_output_v1 name, "all" to affect all outputs, or "selected" for the current output. ### Status Text -The `-status` command is used to write status text. The text may contain in-line color commands in the following format: `^fg/bg(HEXCOLOR)`. For example, `^fg(ff0000)` would set the foreground red. Colors can be reset by omitting the hex value. `^^` represents a single `^` character. +The `-status` command is used to write status text. The text may contain in-line color commands in the following format: `^fg/bg(HEXCOLOR)`. For example, `^fg(ff0000)` would set the foreground red. Colors can be reset by omitting the hex value. `^^` represents a single `^` character. Color command functionality can be disabled with `-no-status-commands`. ## Other Options Run `dwlb -h` for a full list of options. diff --git a/config.def.h b/config.def.h index 47332c1..b641618 100644 --- a/config.def.h +++ b/config.def.h @@ -21,3 +21,6 @@ static pixman_color_t urgent_bg_color = { .red = 0xeeee, .green = 0xeeee, .blue // vertical pixel padding above and below text static uint32_t vertical_padding = 1; + +// allow in-line color commands in status text +static bool status_commands = true; diff --git a/dwlb.c b/dwlb.c index 2bf9751..2f3f4be 100644 --- a/dwlb.c +++ b/dwlb.c @@ -56,12 +56,14 @@ #define USAGE \ "usage: dwlb [OPTIONS]\n" \ "Bar Config\n" \ - " -hide-vacant-tags do not display empty and inactive tags\n" \ - " -no-hide-vacant-tags display empty and inactive tags\n" \ " -hidden bars will initially be hidden\n" \ " -no-hidden bars will not initially be hidden\n" \ " -bottom bars will initially be drawn at the bottom\n" \ " -no-bottom bars will initially be drawn at the top\n" \ + " -hide-vacant-tags do not display empty and inactive tags\n" \ + " -no-hide-vacant-tags display empty and inactive tags\n" \ + " -status-commands enable in-line commands in status text\n" \ + " -no-status-commands disable in-line commands in status text\n" \ " -font [FONT] specify a font\n" \ " -tags [FIRST TAG]...[LAST TAG] specify custom tag names\n" \ " -vertical-padding [PIXELS] specify vertical pixel padding above and below text\n" \ @@ -425,7 +427,7 @@ draw_frame(Bar *b) uint32_t status_width = TEXT_WIDTH(b->status, b->width - xpos_left, b->textpadding, true); draw_text(b->status, b->width - status_width, ypos, foreground, background, &inactive_fg_color, &inactive_bg_color, - b->width, b->height, b->textpadding, true); + b->width, b->height, b->textpadding, status_commands); xpos_left = draw_text(b->title, xpos_left, ypos, foreground, background, b->selmon ? &active_fg_color : &inactive_fg_color, @@ -1047,6 +1049,10 @@ main(int argc, char **argv) hidden = true; } else if (!strcmp(argv[i], "-no-hidden")) { hidden = false; + } else if (!strcmp(argv[i], "-status-commands")) { + status_commands = true; + } else if (!strcmp(argv[i], "-no-status-commands")) { + status_commands = false; } else if (!strcmp(argv[i], "-font")) { if (++i >= argc) DIE("Option -font requires an argument");