diff --git a/README.md b/README.md index 7e00f2c..053b406 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,15 @@ make install ``` ## Usage +Pass `dwlb` as an argument to dwl's `-s` flag. This will populate each connected output with a bar. For example: ```bash -dwl -s dwlb +dwl -s 'dwlb -font "monospace:size=16"' ``` ## Status Text The `-status` option sends status text to existing instances of dwlb. This takes two arguments: a zxdg_output_v1 name (alternatively "all" to affect all outputs or "selected" for the current output) and the text itself. +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. + ## Other Options Run `dwlb -h` for a full list of options. diff --git a/dwlb.c b/dwlb.c index 61959fb..944824e 100644 --- a/dwlb.c +++ b/dwlb.c @@ -193,19 +193,17 @@ handle_cmd(char *cmd, pixman_color_t *fg, pixman_color_t *bg, if (!strcmp(cmd, "bg")) { if (bg && def_bg) { - if (!*arg) { + if (!*arg) *bg = *def_bg; - } else if (parse_color(arg, bg)) { + else if (parse_color(arg, bg)) fprintf(stderr, "Bad color string \"%s\"\n", arg); - } } } else if (!strcmp(cmd, "fg")) { if (fg && def_fg) { - if (!*arg) { + if (!*arg) *fg = *def_fg; - } else if (parse_color(arg, fg)) { + else if (parse_color(arg, fg)) fprintf(stderr, "Bad color string \"%s\"\n", arg); - } } } else { fprintf(stderr, "Unrecognized command \"%s\"\n", cmd); @@ -475,7 +473,7 @@ cleanup(void) unlink(socketpath); } -static struct zwlr_layer_surface_v1_listener layer_surface_listener = { +static const struct zwlr_layer_surface_v1_listener layer_surface_listener = { .configure = layer_surface_configure, .closed = layer_surface_closed, }; @@ -515,7 +513,7 @@ output_description(void *data, struct zxdg_output_v1 *xdg_output, { } -static struct zxdg_output_v1_listener output_listener = { +static const struct zxdg_output_v1_listener output_listener = { .name = output_name, .description = output_description, .done = output_done, @@ -606,7 +604,6 @@ handle_global_remove(void *data, struct wl_registry *registry, uint32_t name) teardown_bar(b); } - static const struct wl_registry_listener registry_listener = { .global = handle_global, .global_remove = handle_global_remove @@ -937,7 +934,6 @@ main(int argc, char **argv) signal(SIGINT, sig_handler); signal(SIGHUP, sig_handler); signal(SIGTERM, sig_handler); - signal(SIGPIPE, SIG_IGN); /* Run */ ready = true;