Allowing xdg-open to open files

FYI, future versions should allow the core snap’s xdg-open to open local files:

https://github.com/snapcore/snapd/pull/4766
https://github.com/snapcore/core/pull/82

The changes have been merged to the 2.31 maintenance branch, so should be available soon.

The /usr/bin/xdg-open in the core snap will now accept local file paths, including relative paths. It then calls the new io.snapcraft.Launcher.OpenFile D-Bus method, passing a file descriptor to prove that the confined application has access to the file. Outside the sandbox, snap userd will show a graphical permission prompt and then launch the file using the real xdg-open.

This feature also supports opening directories, causing them to be opened in the file manager.

1 Like