From 12d866e4f66149d426658b5e11876e739105e256 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 20 Oct 2011 22:25:59 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20start=20i3-nagbar=20when=20usin?= =?UTF-8?q?g=20-C=20to=20validate=20the=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/i3.h | 1 + src/cfgparse.y | 5 ++++- src/main.c | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) 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[] = {