From: Michael Stapelberg Date: Thu, 20 Oct 2011 21:25:59 +0000 (+0100) Subject: Don’t start i3-nagbar when using -C to validate the config X-Git-Tag: 4.1~92^2~26 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=12d866e4f66149d426658b5e11876e739105e256;p=i3%2Fi3 Don’t start i3-nagbar when using -C to validate the config --- diff --git a/include/i3.h b/include/i3.h index 089dfcba..fca983ec 100644 --- a/include/i3.h +++ b/include/i3.h @@ -44,5 +44,6 @@ extern uint8_t root_depth; extern bool xcursor_supported, xkb_supported; extern xcb_window_t root; extern struct ev_loop *main_loop; +extern bool only_check_config; #endif diff --git a/src/cfgparse.y b/src/cfgparse.y index 2c796af1..c9e1eb98 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -266,7 +266,10 @@ static void nagbar_cleanup(EV_P_ ev_cleanup *watcher, int revent) { * */ static void start_configerror_nagbar(const char *config_path) { - fprintf(stderr, "Would start i3-nagscreen now\n"); + if (only_check_config) + return; + + fprintf(stderr, "Starting i3-nagbar due to configuration errors\n"); configerror_pid = fork(); if (configerror_pid == -1) { warn("Could not fork()"); diff --git a/src/main.c b/src/main.c index 50ebaa34..1bf6862d 100644 --- a/src/main.c +++ b/src/main.c @@ -61,6 +61,11 @@ struct ws_assignments_head ws_assignments = TAILQ_HEAD_INITIALIZER(ws_assignment bool xcursor_supported = true; bool xkb_supported = true; +/* This will be set to true when -C is used so that functions can behave + * slightly differently. We don’t want i3-nagbar to be started when validating + * the config, for example. */ +bool only_check_config = false; + /* * This callback is only a dummy, see xcb_prepare_cb and xcb_check_cb. * See also man libev(3): "ev_prepare" and "ev_check" - customise your event loop @@ -194,7 +199,6 @@ int main(int argc, char *argv[]) { bool autostart = true; char *layout_path = NULL; bool delete_layout_path = false; - bool only_check_config = false; bool force_xinerama = false; bool disable_signalhandler = false; static struct option long_options[] = {