feat: Add set_show_hidden_files option for file dialogs #306
+130
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add
FileDialog::set_show_hidden_files()andAsyncFileDialog::set_show_hidden_files()methods to control whether hidden files (dotfiles) are displayed in file picker dialogs.
Motivation
Applications working with dotfiles (
.gitignore,.env, config files) need to show hidden files in file dialogs.This feature is particularly valuable for macOS and Windows apps targeting general audiences. Frameworks like Tauri enable developers to build cross-platform desktop apps for mainstream users who may not be familiar with platform-specific keyboard shortcuts (e.g., Cmd+Shift+. on macOS). Programmatic control over hidden file visibility provides a more accessible and discoverable experience—users shouldn't need to know obscure key combinations to complete a task the application explicitly supports.
On Linux, the standard
Ctrl+Hshortcut is more widely known among desktop users, making this less critical (see XDG Portal note below).Platform Support
NSOpenPanel.setShowsHiddenFilesIFileDialogwithFOS_FORCESHOWHIDDENflaggtk_file_chooser_set_show_hidden--features gtk3)Note on XDG Desktop Portal
The XDG Desktop Portal FileChooser API intentionally does not include a "show hidden files"
option. This is by design - the portal's philosophy delegates UI control to the user and
desktop environment, not the sandboxed application.
Users on Linux with the XDG Portal backend (the default) can press Ctrl+H to toggle
hidden file visibility, which is standard UX across Linux desktop environments.
Reference: XDG Desktop Portal FileChooser Documentation
Example
Test Plan
cargo run --example show_hidden --no-default-features --features gtk3)