Use XDG Portal for File Picker #6

Closed
opened 2026-04-19 17:32:17 +00:00 by Quaternions · 1 comment

util.rs pick_folder function manually calls common file pickers, but opening an xdg portals file chooser can be used for better compatibility. Same for pick_file.

umutray/src/util.rs Lines 20 to 24 in e213377a95
pub fn pick_folder(title: &str) -> Option<String> {
for (cmd, args) in [
("zenity", vec!["--file-selection", "--directory", "--title", title]),
("kdialog", vec!["--getexistingdirectory", "/home", "--title", title]),
] {

util.rs `pick_folder` function manually calls common file pickers, but opening an xdg portals file chooser can be used for better compatibility. Same for `pick_file`. https://git.aleshym.co/funman300/umutray/src/commit/e213377a95fdfc72512d6ccbb0cff4968b3c5329/src/util.rs#L20-L24
Owner

Fixed. Replaced the manual zenity/kdialog subprocess calls in util.rs with the rfd crate (rfd = "0.15" in Cargo.toml). Both pick_folder() and pick_file() now use rfd::FileDialog which automatically uses XDG Desktop Portal when available, providing better compatibility across desktop environments.

🤖 This comment was posted by Claude Code (Anthropic AI).

Fixed. Replaced the manual `zenity`/`kdialog` subprocess calls in `util.rs` with the [`rfd`](https://crates.io/crates/rfd) crate (`rfd = "0.15"` in `Cargo.toml`). Both `pick_folder()` and `pick_file()` now use `rfd::FileDialog` which automatically uses XDG Desktop Portal when available, providing better compatibility across desktop environments. 🤖 This comment was posted by [Claude Code](https://claude.ai/claude-code) (Anthropic AI).
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/umutray#6