mmatyas / pegasus-frontend

A cross platform, customizable graphical frontend for launching emulators and managing your game collection.
http://pegasus-frontend.org
Other
1.17k stars 104 forks source link

Support for desktop files on Linux #1114

Closed rawdatafeel closed 2 months ago

rawdatafeel commented 3 months ago

Ryujinx, RPCS3, and an increasing amount of emulators support creating desktop shortcuts on Linux that automatically open the ROM through the emulator.

For RPCS3 especially, this is helpful as a way to circumvent the file type oddities (installed PKGs and extracted folders). Desktop shortcuts can be treated as the ROM instead and you don't have to worry about trying to figure out how to parse these other file types through a frontend like Pegasus.

I've tried adding desktop as a file type to my metadata file, but I don't think launching desktop files through the command-line (or a frontend) is as simple as that.

ES-DE currently supports launching desktop files so there likely is a way to launch these files through a frontend and it would be great to see if this could somehow be implemented in Pegasus.

mmatyas commented 3 months ago

Hi! On most systems .desktop files can be launched by gtk-launch or, alternatively, xdg-open. Eg. xdg-open /usr/share/applications/firefox.desktop.

rawdatafeel commented 3 months ago

gtk-launch requires strict directories: https://unix.stackexchange.com/questions/393079/gtk-launch-only-works-when-present-working-directory-is-desktop

xdg-open seems a bit finnicky and if I understand how to use it right, requires a default application to open the desktop application.

This is an example of an RPCS3 desktop shortcut:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Exec="/home/javelin/Applications/rpcs3.AppImage" --no-gui "%%RPCS3_GAMEID%%:BLUS30443"
Name=Demon's Souls
Categories=Application;Game
Comment=Demon's Souls
Icon=/home/javelin/.config/rpcs3/Icons/game_icons/BLUS30443/shortcut.png

It doesn't seem like there's a good way of setting a default application for stuff like "%%RPCS3_GAMEID%%:BLUS30443".

Is it possible for Pegasus to instead detect the contents of desktop files and parse the Exec= line? That seems like it would create a more universal way of launching desktop files without all of the fuss above.

I believe that's how ES-DE does it and it works pretty well.

mmatyas commented 3 months ago

Hm, I'm still not convinced this is supposed to be done in Pegasus. Unlike URIs, symlinks, or platform shortcuts, the desktop files are regular files. When you double click on them, there's some program on your system that opens them, reads them, and executes their command, with regards to a defined specification. Therefore, it is not Pegasus' job to reinvent or replace this mechanic. As for what this program is exactly, that's an interesting question; I assume that this is the "default program" xdg-open would use, and it does work on my PC, but the exact setup might differ between distros.

mmatyas commented 2 months ago

I'll close this for now, then, as there's a workaround discussed above.