mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
[filebrowser] Add an option to show hidden files. (#1716)
Add an option to show hidden files by looking up the "show-hidden" filebrowser property and modifying the relevant logic in "filebrowser.c". Co-authored-by: Dave Davenport <DaveDavenport@users.noreply.github.com>
This commit is contained in:
parent
0ed09e6b5e
commit
c1a540c57e
3 changed files with 17 additions and 2 deletions
|
@ -1137,6 +1137,8 @@ configuration {
|
|||
sorting\-method: "name";
|
||||
/** Group directories before files. */
|
||||
directories\-first: true;
|
||||
/** Show hidden files. */
|
||||
show-hidden: false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -691,6 +691,8 @@ configuration {
|
|||
sorting-method: "name";
|
||||
/** Group directories before files. */
|
||||
directories-first: true;
|
||||
/** Show hidden files. */
|
||||
show-hidden: false;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
@ -112,10 +112,13 @@ struct {
|
|||
enum FBSortingTime sorting_time;
|
||||
/** If we want to display directories above files. */
|
||||
gboolean directories_first;
|
||||
/** If we want to show hidden files. */
|
||||
gboolean show_hidden;
|
||||
} file_browser_config = {
|
||||
.sorting_method = FB_SORT_NAME,
|
||||
.sorting_time = FB_MTIME,
|
||||
.directories_first = TRUE,
|
||||
.show_hidden = FALSE,
|
||||
};
|
||||
|
||||
static void free_list(FileBrowserModePrivateData *pd) {
|
||||
|
@ -247,7 +250,10 @@ static void get_file_browser(Mode *sw) {
|
|||
pd->array_length++;
|
||||
continue;
|
||||
}
|
||||
if (rd->d_name[0] == '.') {
|
||||
if (g_strcmp0(rd->d_name, ".") == 0) {
|
||||
continue;
|
||||
}
|
||||
if (rd->d_name[0] == '.' && file_browser_config.show_hidden == FALSE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -368,6 +374,11 @@ static void file_browser_mode_init_config(Mode *sw) {
|
|||
file_browser_config.directories_first = p->value.b;
|
||||
}
|
||||
|
||||
p = rofi_theme_find_property(wid, P_BOOLEAN, "show-hidden", TRUE);
|
||||
if (p != NULL && p->type == P_BOOLEAN) {
|
||||
file_browser_config.show_hidden = p->value.b;
|
||||
}
|
||||
|
||||
if (found_error) {
|
||||
rofi_view_error_dialog(msg, FALSE);
|
||||
|
||||
|
|
Loading…
Reference in a new issue