sonnyp / Junction

Application/browser chooser
https://flathub.org/apps/re.sonny.Junction
GNU General Public License v3.0
467 stars 29 forks source link

Can't launch app when exec contains environment variable #74

Closed Zzombiee2361 closed 2 years ago

Zzombiee2361 commented 2 years ago

I edited my exec of firefox.desktop to MOZ_USE_XINPUT2=1 firefox %u, and now junction can't launch it. The error that appears when opening firefox through junction are:

$ flatpak run re.sonny.Junction https://www.google.com

(re.sonny.Junction:3): Adwaita-WARNING **: 10:57:21.141: Using GtkSettings:gtk-application-prefer-dark-theme with libadwaita is unsupported. Please use AdwStyleManager:color-scheme instead.
Portal call failed: Failed to start command: Failed to execute child process “MOZ_USE_XINPUT2=1” (No such file or directory)
sonnyp commented 2 years ago

Well that's not valid for Exec according to the specification https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables

Do launchers usually support it?

Zzombiee2361 commented 2 years ago

I've skimmed that page and found nothing explicitly said about prohibiting environment variable

But yes, I'm using KDE and launching the desktop file works just fine

sonnyp commented 2 years ago

Can you try the following

Exec=env MOZ_USE_XINPUT2=1 firefox %u

?

Zzombiee2361 commented 2 years ago

Oh yeah it works, this should be documented in the troubleshooting section of readme

sonnyp commented 2 years ago

I've skimmed that page and found nothing explicitly said about prohibiting environment variable

It doesn't need to.

If you understand the following then it's very clear that FOO=bar something isn't a valid Exec key :

The Exec key must contain a command line. A command line consists of an executable program optionally followed by one or more arguments. The executable program can either be specified with its full path or with the name of the executable only. If no full path is provided the executable is looked up in the $PATH environment variable used by the desktop environment. The name or path of the executable program may not contain the equal sign ("="). Arguments are separated by a space.

Oh yeah it works, this should be documented in the troubleshooting section of readme

A pull request and thank you would have been welcome.

Zzombiee2361 commented 2 years ago

Sorry if I offended you. Thank you for adding it in the readme