diff --git a/RELEASE-NOTES-next b/RELEASE-NOTES-next index d5db53220..78984c8a3 100644 --- a/RELEASE-NOTES-next +++ b/RELEASE-NOTES-next @@ -42,3 +42,4 @@ working. Please reach out to us in that case! • build: correctly provide auxiliary functions when needed • build: fix issues with parallel build • set _NET_DESKTOP_VIEWPORT after randr changes + • fix a bug with i3-nagbar not starting after it has already started once diff --git a/src/commands.c b/src/commands.c index 8310c8112..3f8c2695e 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1615,8 +1615,16 @@ void cmd_exit(I3_CMD) { */ void cmd_reload(I3_CMD) { LOG("reloading\n"); + kill_nagbar(config_error_nagbar_pid, false); kill_nagbar(command_error_nagbar_pid, false); + /* start_nagbar() will refuse to start a new process if the passed pid is + * set. This will happen when our child watcher is triggered by libev when + * the loop re-starts. However, config errors might be detected before + * that since we will read the config right now with load_configuration. + * See #4104. */ + config_error_nagbar_pid = command_error_nagbar_pid = -1; + load_configuration(NULL, C_RELOAD); x_set_i3_atoms(); /* Send an IPC event just in case the ws names have changed */ diff --git a/src/util.c b/src/util.c index 2ca5b330d..641ce3ce1 100644 --- a/src/util.c +++ b/src/util.c @@ -336,18 +336,20 @@ char *pango_escape_markup(char *input) { static void nagbar_exited(EV_P_ ev_child *watcher, int revents) { ev_child_stop(EV_A_ watcher); + int exitcode = WEXITSTATUS(watcher->rstatus); if (!WIFEXITED(watcher->rstatus)) { - ELOG("ERROR: i3-nagbar did not exit normally.\n"); - return; + ELOG("i3-nagbar (%d) did not exit normally. This is not an error if the config was reloaded while a nagbar was active.\n", watcher->pid); + } else if (exitcode != 0) { + ELOG("i3-nagbar (%d) process exited with status %d\n", watcher->pid, exitcode); + } else { + DLOG("i3-nagbar (%d) process exited with status %d\n", watcher->pid, exitcode); } - int exitcode = WEXITSTATUS(watcher->rstatus); - DLOG("i3-nagbar process exited with status %d\n", exitcode); - if (exitcode == 2) { - ELOG("ERROR: i3-nagbar could not be found. Is it correctly installed on your system?\n"); + pid_t *nagbar_pid = watcher->data; + if (*nagbar_pid == watcher->pid) { + /* Only reset if the watched nagbar is the active nagbar */ + *nagbar_pid = -1; } - - *((pid_t *)watcher->data) = -1; } /*