commit 754bfa41a9402a6b94ade8742fe81f8c3799e34b from: Caleb Stein date: Wed May 13 09:30:27 2026 UTC reload weather on SIGWINCH commit - 6a76b2a232c7a2636e9b2060bee394f867a760b8 commit + 754bfa41a9402a6b94ade8742fe81f8c3799e34b blob - 6181d1bb7c8f9ca62d555a8ea2a4d641a4f069ec blob + 1c4546a812004569752d41c3e74f859f621e5cb9 --- src/main.c +++ src/main.c @@ -34,6 +34,7 @@ static volatile sig_atomic_t should_quit = 0; static volatile sig_atomic_t reload_config = 0; static volatile sig_atomic_t reload_mail = 0; static volatile sig_atomic_t reload_battery = 0; +static volatile sig_atomic_t reload_weather = 0; static bool weather_loc_valid = false; static bool mail_path_valid = false; @@ -222,6 +223,9 @@ sig_handler(int sig) case SIGCHLD: while (waitpid(-1, NULL, WNOHANG) > 0); break; + case SIGWINCH: + reload_weather = 1; + break; case SIGUSR1: reload_mail = 1; break; @@ -245,6 +249,7 @@ install_signal_handlers(void) if (sigaction(SIGINT, &sa, NULL) == -1) perror("sigaction"); if (sigaction(SIGHUP, &sa, NULL) == -1) perror("sigaction"); if (sigaction(SIGCHLD, &sa, NULL) == -1) perror("sigaction"); + if (sigaction(SIGWINCH, &sa, NULL) == -1) perror("sigaction"); if (sigaction(SIGUSR1, &sa, NULL) == -1) perror("sigaction"); if (sigaction(SIGUSR2, &sa, NULL) == -1) perror("sigaction"); } @@ -422,8 +427,9 @@ main(int argc, char *argv[]) } /* Weather */ - if (weather_loc_valid && weather_pfd && timespeccmp(&now, &clocks[WEATHER_CLOCK], >=)) + if (weather_loc_valid && weather_pfd && (reload_weather == 1 || timespeccmp(&now, &clocks[WEATHER_CLOCK], >=))) { + reload_weather = 0; get_weather(weather_pipe[1]); while (timespeccmp(&now, &clocks[WEATHER_CLOCK], >=)) timespecadd(&clocks[WEATHER_CLOCK], &weather_interval, &clocks[WEATHER_CLOCK]);