added file previev

This commit is contained in:
nova
2025-06-02 22:53:08 +02:00
parent f7c1d34e05
commit 0053c7cb88
6 changed files with 73 additions and 28 deletions

15
main.c
View File

@ -17,6 +17,7 @@ unsigned int temp_width = 0;
unsigned int settings;
unsigned int file_modifiers;
unsigned int status;
unsigned int timeout_time = 0;
char input = 0;
void render_pass(WINDOW *wint, WINDOW *winb, WINDOW *winl, WINDOW *winm, WINDOW *winr);
@ -60,6 +61,7 @@ int main() {
pthread_cancel(thread_r);
threading = 0;
status &= ~STATUS_RUN_BACKEND;
status &= ~STATUS_RELOAD_DIRECTORY;
status |= STATUS_UPDATE_SCREEN_0;
} else {
pthread_create(&thread_t, NULL, thread_top, win_t); /*top bar*/
@ -72,7 +74,12 @@ int main() {
}
if ((input = getch())) {
user_interactions(&input, &status, &settings);
timeout_time = 5;
} else {
timeout_time += 10;
}
timeout(timeout_time); /* blocking timeout of getch() */
render_pass(win_t, win_b, win_l, win_m, win_r);
@ -139,14 +146,14 @@ void render_pass(WINDOW *win_t, WINDOW *win_b, WINDOW *win_l, WINDOW *win_m, WIN
/*this function exists for things done at startup (initialization, reading config, etc)*/
void init() {
initscr(); /*start ncurses*/
noecho(); /*hide keyboard input*/
timeout(50); /*blocking timeout of getch()*/
initscr(); /* start ncurses */
noecho(); /* hide keyboard input */
timeout(timeout_time); /* blocking timeout of getch() */
keypad(stdscr, TRUE);
curs_set(0);
/*file_modifiers = (FILE_MODIFIERS_HIDDEN_FILES | FILE_MODIFIERS_SORT_BITMASK);*/
status = (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK);
status = (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY);
if (getuid() == 0) {
status += STATUS_USER_ROOT;
}