From e26fd91cf868824726d74db7388d05736e1fd7da Mon Sep 17 00:00:00 2001 From: hwangcc23 Date: Tue, 10 Apr 2018 22:20:42 +0800 Subject: [PATCH] Add an i3bar flag: --verbose Fix the issue #3220. (https://github.com/i3/i3/issues/3220) --- docs/debugging | 3 ++- i3bar/include/configuration.h | 2 +- i3bar/src/main.c | 7 ++++++- src/main.c | 3 ++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/debugging b/docs/debugging index dd26f98d..562a11f2 100644 --- a/docs/debugging +++ b/docs/debugging @@ -160,7 +160,8 @@ flood kicks. == Debugging i3bar -To debug i3bar problems, add +verbose yes+ to all +bar {}+ blocks in your i3 +To debug i3bar problems, use the +--verbose+ commandline parameter, +or add +verbose yes+ to all +bar {}+ blocks in your i3 config, reload your config and then restart all i3bar instances like this: --------------------------------------------------------------------- diff --git a/i3bar/include/configuration.h b/i3bar/include/configuration.h index e60d7483..27fb518f 100644 --- a/i3bar/include/configuration.h +++ b/i3bar/include/configuration.h @@ -47,7 +47,7 @@ typedef struct config_t { bindings; position_t position; - int verbose; + bool verbose; struct xcb_color_strings_t colors; bool disable_binding_mode_indicator; bool disable_ws; diff --git a/i3bar/src/main.c b/i3bar/src/main.c index 069803d4..f90bb312 100644 --- a/i3bar/src/main.c +++ b/i3bar/src/main.c @@ -62,6 +62,7 @@ void print_usage(char *elf_name) { printf("-s, --socket \tConnect to i3 via \n"); printf("-h, --help Display this help message and exit\n"); printf("-v, --version Display version number and exit\n"); + printf("-V, --verbose Enable verbose mode\n"); printf("\n"); printf(" PLEASE NOTE that i3bar will be automatically started by i3\n" " as soon as there is a 'bar' configuration block in your\n" @@ -106,9 +107,10 @@ int main(int argc, char **argv) { {"bar_id", required_argument, 0, 'b'}, {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'}, + {"verbose", no_argument, 0, 'V'}, {NULL, 0, 0, 0}}; - while ((opt = getopt_long(argc, argv, "b:s:hv", long_opt, &option_index)) != -1) { + while ((opt = getopt_long(argc, argv, "b:s:hvV", long_opt, &option_index)) != -1) { switch (opt) { case 's': socket_path = expand_path(optarg); @@ -120,6 +122,9 @@ int main(int argc, char **argv) { case 'b': config.bar_id = sstrdup(optarg); break; + case 'V': + config.verbose = true; + break; default: print_usage(argv[0]); exit(EXIT_SUCCESS); diff --git a/src/main.c b/src/main.c index 194ef05c..d5d4dcef 100644 --- a/src/main.c +++ b/src/main.c @@ -949,8 +949,9 @@ int main(int argc, char *argv[]) { Barconfig *barconfig; TAILQ_FOREACH(barconfig, &barconfigs, configs) { char *command = NULL; - sasprintf(&command, "%s --bar_id=%s --socket=\"%s\"", + sasprintf(&command, "%s %s --bar_id=%s --socket=\"%s\"", barconfig->i3bar_command ? barconfig->i3bar_command : "i3bar", + barconfig->verbose ? "-V" : "", barconfig->id, current_socketpath); LOG("Starting bar process: %s\n", command); start_application(command, true); -- 2.39.2