Don’t start i3-nagbar when using -C to validate the config

This commit is contained in:
Michael Stapelberg 2011-10-20 22:25:59 +01:00
parent bf408c9a08
commit 12d866e4f6
3 changed files with 10 additions and 2 deletions

View File

@ -44,5 +44,6 @@ extern uint8_t root_depth;
extern bool xcursor_supported, xkb_supported; extern bool xcursor_supported, xkb_supported;
extern xcb_window_t root; extern xcb_window_t root;
extern struct ev_loop *main_loop; extern struct ev_loop *main_loop;
extern bool only_check_config;
#endif #endif

View File

@ -266,7 +266,10 @@ static void nagbar_cleanup(EV_P_ ev_cleanup *watcher, int revent) {
* *
*/ */
static void start_configerror_nagbar(const char *config_path) { 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(); configerror_pid = fork();
if (configerror_pid == -1) { if (configerror_pid == -1) {
warn("Could not fork()"); warn("Could not fork()");

View File

@ -61,6 +61,11 @@ struct ws_assignments_head ws_assignments = TAILQ_HEAD_INITIALIZER(ws_assignment
bool xcursor_supported = true; bool xcursor_supported = true;
bool xkb_supported = true; bool xkb_supported = true;
/* This will be set to true when -C is used so that functions can behave
* slightly differently. We dont 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. * 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 * 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; bool autostart = true;
char *layout_path = NULL; char *layout_path = NULL;
bool delete_layout_path = false; bool delete_layout_path = false;
bool only_check_config = false;
bool force_xinerama = false; bool force_xinerama = false;
bool disable_signalhandler = false; bool disable_signalhandler = false;
static struct option long_options[] = { static struct option long_options[] = {