Bug 507330

Summary: KIO::highlightInFileManager does not work in Flatpak apps
Product: [Frameworks and Libraries] frameworks-kio Reporter: Nate Graham <nate>
Component: generalAssignee: KIO Bugs <kio-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: kde, kde, kdedev, kdelibs-bugs-null, postix
Priority: NOR    
Version First Reported In: 6.16.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nate Graham 2025-07-21 19:26:28 UTC
This is because it calls out to org.freedesktop.FileManager1, which is blacklisted by default in Flatpak.

Instead of whitelisting it in each one of our apps (manual and error-prone) or our SDK (over-broad and controversial), we can change the DBus call from:

org.freedesktop.FileManager1 /org/freedesktop/FileManager1 org.freedesktop.FileManager1 ShowItems

to:

org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.OpenURI.OpenDirectory

…but only if we detect we're in a sandbox.
Comment 2 David Edmundson 2025-07-21 21:18:42 UTC
>…but only if we detect we're in a sandbox.

I can't see a reason to do that. It should work with anything.
Simpler code is better code.
Comment 3 Nate Graham 2025-07-21 21:44:52 UTC
I guess it's a trade-off between code complexity vs internal implementation complexity. Always going through the portal means:
- A de facto dependency on xdg-desktop-portal in KIO
- A more complex internal path to opening the file manager, and therefore potentially lower speed and higher vulnerability to the portal functionality being broken
Comment 4 David Redondo 2025-07-22 09:02:54 UTC
OpenDirectory only supports one File and you have to have an open fd to it