Xdg-open path doesn't get passed through to app

Hi,

I have an electron app and building it with electron-builder which is used to package up the app.

I’ve defined my own protocol/mimetype for the app for deeplinking “://”, and electron-builder automatically creates the correct .desktop file to handle the mimetype.

If I install the app using a deb file, everything is fine, my app is able to read the protocol url and parse the details however if I install the app using snap, the application gets opened but it never receives the URL that opened it.

What do I need to do to get snap to pass through the URL?

Thanks

Can you provide the output of xdg-mime query default x-scheme-handler/<your-protocol>? What is the value of MimeType= and Exec= in the desktop file of your snap application found under /var/lib/snapd/desktop/?

2 Likes

Sure.

$ xdg-mime query default x-scheme-handler/openteam
openteam_openteam.desktop

cat /var/lib/snapd/desktop/applications/openteam_openteam.desktop
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/openteam_openteam.desktop /snap/bin/openteam
MimeType=x-scheme-handler/openteam;x-scheme-handler/openteamdev;

You’re missing the %f or %F parameter:

Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/openteam_openteam.desktop /snap/bin/openteam "%f"

Thanks Daniel, found a bug in the electron-build library where only snap builds don’t get $U appended. ($U was the one I needed)

Thanks for the help!

1 Like