sonnyp / Junction

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

Path to the opened file not passed to some programs #17

Closed ubuntuegor closed 2 years ago

ubuntuegor commented 2 years ago

I have set Junction to open video files, and while some programs like mpv and GNOME Videos work with Junction properly, others like MediaInfo-GUI and Avidemux just open in a blank state instead of opening the selected file.

I've noticed that .desktop files for Mediainfo and Avidemux use %f as launch args in the corresponding Exec lines whereas most other programs use %U (difference being local file/URI I assume?)

Perhaps something can be done to properly launch those programs when Junction is used to open a local file.

sonnyp commented 2 years ago

Can you reproduce the problem after lunching Junction from the terminal and share the output?

Something like

flatpak run re.sonny.Junction ~/Videos/example.mp4
ubuntuegor commented 2 years ago

Yes, this issue remains:

image

Looking at task manager, it omits the supposed path altogether:

image

sonnyp commented 2 years ago

I found the issue, it's what you expected. Would you like to give it a try ?

Should be fairly easy and a nice introduction to contributing to Junction and GNOME dev if you're interested.

The function is openWithApplication https://github.com/sonnyp/Junction/blob/main/src/AppButton.js#L63

Instead of always using appInfo.launch_uris - we want to do something like

let success
if (appInfo.supports_uris()) {
  success = appInfo.launch_uris(...)
} else if (appInfo.supports_files()) {
  success = appInfo.launch_files(...)
} else {
  success = appInfo.launch(...)
}

References

ubuntuegor commented 2 years ago

Sure, I'll submit a pull request soon, thanks!