diff --git a/completion.c b/completion.c index 0f837a9..3877dd0 100644 --- a/completion.c +++ b/completion.c @@ -45,6 +45,8 @@ list_files(zathura_t* zathura, const char* current_path, const char* current_fil bool show_hidden = false; girara_setting_get(zathura->ui.session, "show-hidden", &show_hidden); + bool show_directories = true; + girara_setting_get(zathura->ui.session, "show-directories", &show_directories); /* read files */ char* name = NULL; @@ -74,6 +76,11 @@ list_files(zathura_t* zathura, const char* current_path, const char* current_fil char* full_path = g_strdup_printf("%s%s%s", current_path, tmp, e_name); if (g_file_test(full_path, G_FILE_TEST_IS_DIR) == true) { + if (show_directories == false) { + g_free(e_name); + g_free(full_path); + continue; + } char* tmp_path = full_path; full_path = g_strdup_printf("%s/", full_path); g_free(tmp_path); diff --git a/config.c b/config.c index 9ff4f3d..bdc06e9 100644 --- a/config.c +++ b/config.c @@ -94,6 +94,8 @@ config_load_default(zathura_t* zathura) girara_setting_add(gsession, "adjust-open", "best-fit", STRING, false, "Adjust to when opening file", NULL, NULL); bool_value = false; girara_setting_add(gsession, "show-hidden", &bool_value, BOOLEAN, false, "Show hidden files and directories", NULL, NULL); + bool_value = true; + girara_setting_add(gsession, "show-directories", &bool_value, BOOLEAN, false, "Show directories", NULL, NULL); /* define default shortcuts */ girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_c, NULL, sc_abort, 0, 0, NULL);