commit f17a44b79a47498b6ccfcd2a97ef3a23a7f7aeda from: Caleb Stein date: Sat Jun 13 00:48:27 2026 UTC don't use config file for timeouts commit - 7e9b1d575ff8c792714fe787010a2296996eee72 commit + f17a44b79a47498b6ccfcd2a97ef3a23a7f7aeda blob - b6f1aeaeda3d21bdc8104572062cac0b7a3e339e blob + f1cb02e9b387ed768122a486ebac75a9cb33c85e --- include/statbar.h +++ include/statbar.h @@ -26,10 +26,7 @@ extern void close_display(void); extern bool weather_loc_valid; extern bool mail_path_valid; -extern void read_config(struct timespec *clock_interval, - struct timespec *battery_interval, - struct timespec *cputemp_interval, - struct timespec *fanspeed_interval); +extern void read_config(void); extern int open_command_interface(void); extern void close_command_interface(void); blob - bfec6b9c22673be04a39246a02ff09db55dc7595 blob + 69fa60c0842cd0e65676319e03802e91134cdb44 --- src/fs.c +++ src/fs.c @@ -37,12 +37,8 @@ mkdir_recursive(char *path) } void -read_config( - struct timespec *clock_interval, - struct timespec *battery_interval, - struct timespec *cputemp_interval, - struct timespec *fanspeed_interval -){ +read_config(void) +{ char *config_full_path; time_t clock_ms; time_t battery_ms; @@ -142,47 +138,10 @@ read_config( continue; } - /* 10 minute max is arbitrary */ - delim++; - val = (int)strtonum(delim, 1, 600000, NULL); - if (val == 0) - goto read_err; - - if (strncmp(line, "clock interval", strlen("clock interval")) == 0) - { - clock_interval->tv_sec = val / 1000; - clock_interval->tv_nsec = (val % 1000) * 1000000; - } - else if (strncmp(line, "battery interval", strlen("battery interval")) == 0) - { - battery_interval->tv_sec = val / 1000; - battery_interval->tv_nsec = (val % 1000) * 1000000; - } - else if (strncmp(line, "cputemp interval", strlen("cputemp interval")) == 0) - { - cputemp_interval->tv_sec = val / 1000; - cputemp_interval->tv_nsec = (val % 1000) * 1000000; - } - else if (strncmp(line, "fanspeed interval", strlen("fanspeed interval")) == 0) - { - fanspeed_interval->tv_sec = val / 1000; - fanspeed_interval->tv_nsec = (val % 1000) * 1000000; - } - else - { - goto read_err; - } - - n = 0; - continue; - - read_err: - (void)printf("Config syntax error line %d: %s\n", i, line); - free(line); - (void)fclose(file); - - return; + read_err: + (void)printf("Config syntax error line %d: %s\n", i, line); } + free(line); if (ferror(file)) perror("getline"); blob - a98021bcb54aa680ac2e4b89486250ddd8da7bf6 blob + 2cbfc4b253df7e5c98eb28043472e4be92209fa4 --- src/main.c +++ src/main.c @@ -90,7 +90,7 @@ main(void) struct timespec *next_event; struct timespec next_interval; struct timespec clock_interval = { .tv_sec = 60 }; - struct timespec battery_interval = { .tv_sec = 5 }; + struct timespec battery_interval = { .tv_sec = 10 }; struct timespec cputemp_interval = { .tv_sec = 2 }; struct timespec fanspeed_interval = { .tv_sec = 3 }; struct timespec weather_interval = { .tv_sec = 1800 }; @@ -114,7 +114,7 @@ main(void) /* Init components */ (void)puts("Reading config..."); - read_config(&clock_interval, &battery_interval, &cputemp_interval, &fanspeed_interval); + read_config(); (void)clock_gettime(CLOCK_BOOTTIME, &now); normalize_clock_interval(&now, &clocks[CLOCK_CLOCK]); timespecadd(&now, &cputemp_interval, &clocks[CPUTEMP_CLOCK]); @@ -178,7 +178,7 @@ main(void) { if (reload_config) { - read_config(&clock_interval, &battery_interval, &cputemp_interval, &fanspeed_interval); + read_config(); reload_config = 0; } if (mail_path_valid == false)