Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update flatpak .desktop generation #880

Merged
merged 2 commits into from
Aug 10, 2023
Merged

Update flatpak .desktop generation #880

merged 2 commits into from
Aug 10, 2023

Conversation

termdisc
Copy link
Contributor

@termdisc termdisc commented Aug 10, 2023

The flatpak version of steamtinkerlaunch resolves its realpath to be /app/utils/bin/steamtinkerlaunch, which is incorrectly set in a .desktop shortcut, i.e., Exec=/app/utils/steamtinkerlaunch/bin/steamtinkerlaunch hedgemodmanager start auto "%u"

The shortcut should be directed to flatpak run --command=steamtinkerlaunch com.valvesoftware.Steam <args> instead.

The changes are directed to adding an if condition that changes the Exec= line based on whether [ $INFLATPAK -eq 1 ], such that if stl is running in a flatpak environment, the appropriate flatpak command is used

The flatpak version of steamtinkerlaunch resolves its realpath to be `/app/utils/bin/steamtinkerlaunch`, which is incorrectly set in a .desktop shortcut. The shortcut should be directed to `flatpak run --command=steamtinkerlaunch com.valvesoftware.Steam <args>` instead.
@termdisc termdisc marked this pull request as ready for review August 10, 2023 13:59
@sonic2kk
Copy link
Owner

Thanks a bunch for opening a PR! It's nice to see someone able to help out with the Flatpak side :-)

To confirm, this is related to the 1-click mod install buttons, correct? And maybe this is silly to ask for the sake of being explicit, could you mention the problem you faced and that this change fixed it?

I don't use Flatpak Steam so I don't use Flatpak STL either, so if you can confirm the problem this fixed I'm happy to merge this! The changes look good to me and ShellCheck is all good too.

@termdisc
Copy link
Contributor Author

This is related to both the 1-click mod install buttons, and HMM has its own launcher .desktop shortcut as well.

could you mention the problem you faced and that this change fixed it?

When attempting to launch HedgeModManager-steamtinkerlaunch.desktop that's auto-generated by STL, the command line resolves to /app/utils/steamtinkerlaunch/bin/steamtinkerlaunch hedgemodmanager start auto "%u", which will not launch STL or HMM because the /app/utils/steamtinkerlaunch/bin/steamtinkerlaunch path is solely within the flatpak environment and not accessible from the outside via that path.

The correct syntax for running commands within flatpak environments is flatpak run --command=<COMMAND> <flatpakID> <additional args>.

Example execution via terminal:

> flatpak run --command=steamtinkerlaunch com.valvesoftware.Steam hedgemodmanager start auto
WARNING: Can't reach GitHub - Not attempting to download HedgeModManager
Checking latest available HedgeModManager Release version
Latest available version is '7.10-1' - Checking to see if we are up-to-date
Latest HedgeModManager is already downloaded or was downloaded previously
HedgeModManager is up-to-date
Finished installing HedgeModManager
Adding HedgeModManager to application menu and setting up link handlers
Setting up installed HedgeModManager compatible games

(/app/bin/notify-send:2298): libnotify-WARNING **: 14:06:36.522: Running in confined mode, using Portal notifications. Some features and hints won't be supported
libnotify-Message: 14:06:36.522: Category is not available when using Portal Notifications
libnotify-Message: 14:06:36.522: App Name is not available when using Portal Notifications
Finished configuring installed HedgeModManager games
Starting HedgeModManager

(/app/bin/notify-send:2668): libnotify-WARNING **: 14:06:36.674: Running in confined mode, using Portal notifications. Some features and hints won't be supported
libnotify-Message: 14:06:36.675: Category is not available when using Portal Notifications
libnotify-Message: 14:06:36.675: App Name is not available when using Portal Notifications
wineserver: using server-side synchronization.
wine: RLIMIT_NICE is <= 20, unable to use setpriority safely
[2023-08-10 14:06:37.857] [MANGOHUD] [info] [config.cpp:118] skipping config: '/home/outphase/.var/app/com.valvesoftware.Steam/config/MangoHud/wine-explorer.conf' [ not found ]
[2023-08-10 14:06:37.857] [MANGOHUD] [info] [config.cpp:118] skipping config: '/var/home/outphase/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/common/Proton 7.0/dist/bin/MangoHud.conf' [ not found ]
[2023-08-10 14:06:37.857] [MANGOHUD] [info] [config.cpp:118] skipping config: '/home/outphase/.var/app/com.valvesoftware.Steam/config/MangoHud/wine64-preloader.conf' [ not found ]
[2023-08-10 14:06:37.857] [MANGOHUD] [info] [config.cpp:123] parsing config: '/home/outphase/.var/app/com.valvesoftware.Steam/config/MangoHud/MangoHud.conf'
sh: line 1: glxinfo: command not found

<HMM launches here>

For the 1-click install buttons, I will need to experiment just a little bit more because I switched to gnome very recently, and the MIME stuff is handled just slightly differently than I'm used to.

@sonic2kk
Copy link
Owner

Thanks for the clarification. This all makes sense then, looks good to merge to me. I appreciate the detail too!

I will go out on a limb and guess the path generation is wrong and Flatpak only because it tries to resolve the path inside Flatpak? But either way this fix looks correct to me and makes sense.

For the 1-click install buttons, I will need to experiment just a little bit more

My recommendation is to avoid these buttons at all costs, on any operating system, and all I can tell you is that no one apart from me has ever reported that these work either for HMM, MO2, or Vortex. Maybe you'll have success but this is a friendly heads up that it is expected that this will not work.


I will merge this now, thanks!

@sonic2kk sonic2kk merged commit 8cb4b1a into sonic2kk:master Aug 10, 2023
@sonic2kk
Copy link
Owner

sonic2kk commented Aug 10, 2023

I modified the commit message slightly just to note that this is for mod tools, I hope that is okay. Thanks again!

Credit has also been given in the changelog.

@termdisc
Copy link
Contributor Author

My recommendation is to avoid these buttons at all costs, on any operating system, and all I can tell you is that no one apart from me has ever reported that these work either for HMM, MO2, or Vortex. Maybe you'll have success but this is a friendly heads up that it is expected that this will not work.

I did get it to work with Reloaded-II for Persona mods, but that one was an .exe that is run via Protontricks Launcher in the same prefix environment rather than being standalone like anything STL installs. For that, the .desktop handler needs to also be added to ~/.local/share/applications/mimeapps.list. (See "advanced stuff" here).

This will be a later task, and if I manage to get it to work, I'll file another PR. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants