Repository navigation
Conversation
On Linux, `open_path` and `open_url` spawned launchers resolved through `PATH`. AppImages prepend their bundled `usr/bin`, so a bundled `xdg-open` can shadow the host binary and swallow the request. Route directories through `org.freedesktop.FileManager1.ShowFolders` and files and URLs through `org.freedesktop.portal.OpenURI`, falling back to the existing `open` path when the service is unavailable. This reaches the host desktop in AppImage, Flatpak and Snap builds. Refs: tauri-apps#3724
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
On Linux,
open_pathandopen_urlnow talk to the desktop over D-Bus instead of spawningxdg-open/gio/kde-open*found throughPATH:org.freedesktop.FileManager1.ShowFoldersorg.freedesktop.portal.OpenURI.OpenFileorg.freedesktop.portal.OpenURI.OpenURIAny D-Bus error falls back to the existing
opencall, so headless setups keep working. The main benefit is for Flatpak and Snap builds, where spawning a host handler throughPATHis not reliable. This also covers desktops without a workingxdg-openorgio.The D-Bus calls run on a dedicated thread because
zbus::blockingstarts its own runtime, matching whatreveal_item_in_diralready does.Tested with
cargo test -p tauri-plugin-opener,cargo clippy -p tauri-plugin-opener --all-targetsandcargo fmt --check. The classification test covers files, folders, URLs and unknown inputs.Note: the original AppImage report (#3724) turned out to be caused by Tauri CLI 2.11.4 bundling
xdg-open; CLI 2.12.0+ no longer does. This PR is therefore an enhancement for sandboxed builds and broken launcher setups, not a fix for that specific AppImage case.