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[] = {