From b46d2da30842786bf53285125782fb215054c606 Mon Sep 17 00:00:00 2001 From: nova Date: Wed, 24 Sep 2025 23:07:29 +0200 Subject: [PATCH] delta time to reload directory --- config.h | 5 +++-- main.c | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/config.h b/config.h index c0ee4b2..5205ba9 100644 --- a/config.h +++ b/config.h @@ -1,5 +1,6 @@ -#define SETTINGS_LINE_NUMBERS 2 /* 0 is disabled, 1 is enabled, 2 is relative */ -#define SETTINGS_UEBERZUG_IMAGE_PREVIEW 1 /* 0 is disabled, 1 is enabled, 2 is with caching */ +#define SETTINGS_LINE_NUMBERS 2 /* 0 is disabled, 1 is enabled, 2 is relative */ +#define SETTINGS_UEBERZUG_IMAGE_PREVIEW 1 /* 0 is disabled, 1 is enabled, 2 is with caching */ +#define SETTINGS_RELOAD_DIR_DELTA 10 /* 0 is disabled, time in seconds of how often the directory should be reload */ /* {{{ */ #ifndef CONFIG_GUARD diff --git a/main.c b/main.c index 083a8fc..3bb6da7 100644 --- a/main.c +++ b/main.c @@ -60,6 +60,11 @@ int main(){ char threading = 0; terminal_width_empty_line = malloc(terminal_width); + #if SETTINGS_RELOAD_DIR_DELTA != 0 + time_t t; + time_t dt; + time(&t); + #endif pthread_create(&thread_t, NULL, thread_top, &status); /*top bar*/ pthread_create(&thread_l, NULL, thread_lft, &status); /*parent_content slash win_l*/ @@ -92,6 +97,14 @@ int main(){ render_pass(); + #if SETTINGS_RELOAD_DIR_DELTA != 0 + time(&dt); + if (dt - t >= SETTINGS_RELOAD_DIR_DELTA) { + time(&t); + status |= (STATUS_RUN_BACKEND | STATUS_RELOAD_DIRECTORY); + } + #endif + } threading_free(); free(start_path);