Skip to content

Conversation

@bbopen
Copy link

@bbopen bbopen commented Jan 22, 2026

Summary

Add FileDialog::set_show_hidden_files() and AsyncFileDialog::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+H shortcut is more widely known among desktop users, making this less critical (see XDG Portal note below).

Platform Support

Platform Implementation Notes
macOS NSOpenPanel.setShowsHiddenFiles ✅ Works
Windows IFileDialog with FOS_FORCESHOWHIDDEN flag Needs testing
Linux (GTK3) gtk_file_chooser_set_show_hidden ✅ Works (requires --features gtk3)
Linux (XDG Portal) Not supported Intentional - see below
WASM Not applicable

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

let file = FileDialog::new()
    .set_show_hidden_files(true)
    .pick_file();

Test Plan

  • Compiles on macOS
  • Manual test on macOS - hidden files visible
  • Test on Windows
  • Test on Linux GTK3 (cargo run --example show_hidden --no-default-features --features gtk3)

brett-bonner_infodesk and others added 2 commits January 22, 2026 13:29
Add FileDialog::set_show_hidden_files() and AsyncFileDialog::set_show_hidden_files()
methods to control whether hidden files (dotfiles) are displayed in file picker
dialogs.

Platform support:
- macOS: Uses NSOpenPanel.setShowsHiddenFiles
- Windows: Uses IFileDialog FOS_FORCESHOWHIDDEN flag
- Linux (GTK3): Uses gtk_file_chooser_set_show_hidden
- Linux (XDG Portal): Not supported (option is ignored)
- WASM: Not applicable (browser controls this)

This is useful for applications that need to work with dotfiles like .gitignore,
.env, configuration files, etc.
The get_options/add_options methods need access to IFileDialogV::GetOptions
to properly combine the FOS_FORCESHOWHIDDEN flag with existing dialog options.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bbopen bbopen marked this pull request as ready for review January 22, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant