sonic2kk / steamtinkerlaunch

Linux wrapper tool for use with the Steam client for custom launch options and 3rd party programs
GNU General Public License v3.0
2.1k stars 70 forks source link

Non-Steam: SteamGridDB and getid/gettitle Commandline Support #963

Closed sonic2kk closed 9 months ago

sonic2kk commented 9 months ago

Heavily WIP, currently does the following:

Remaining work before I edit this PR description with something more informative and structured:

sonic2kk commented 9 months ago

This PR adds many, many functions for interfacing with the shortcuts.vdf file, including fetching and editing specific entries. These functions will be generally useful and will also allow for, in this PR, updating the icon for Non-Steam Games.

The next step for this PR is to fetch the icon for Non-Steam Games.

sonic2kk commented 9 months ago

Oh yeah, we'll also need to run shellcheck and do some fixups. I haven't checked yet but I suspect it'll be a real mess...

sonic2kk commented 9 months ago

Untested implementation for setting the shortcut icon. There are now three mostly untested changes:

  1. getSteamGridDBNonSteamIcon was broken out into a separate function. This works with getGridsForNonSteamGames but I didn't test if it works for addNonSteamGame yet. This needs tested
  2. getSteamGridDBNonSteamIcon now returns the icon path, which we didn't check for before. We need to make sure that this icon path is valid at least for addNonSteamGame, and that it works as expected.
  3. editSteamShortcutEntry was tested during debugging and updated a hardcoded icon path for a given shortcut, but has not been tested in getSteamGridDBNonSteamIcon yet.

I also did a quick run of ShellCheck. No glaring errors, just a couple of style, globbing, and unused/unnecessary variable changes that need addressed. Once the above testing is done and this is all working, it should be straightforward to address those and get this merged.

We're almost there!

sonic2kk commented 9 months ago

Can't set the icon in getSteamGridDBNonSteamIcon in its current form just yet, because it sets the icon to all the downloading output. Damn! We'll figure out a way though, probably tomorrow.

It is updating the shortcuts.vdf file though, so it will work once we correctly pass it the path for the icon.

sonic2kk commented 9 months ago

We should also add some more logging before merging this PR.

sonic2kk commented 9 months ago

Got some rough changes locally that I'll push soon which resolve the remaining functionality issues, and allow icons to be downloaded and set when updating grids for Non-Steam Games! We correctly edit shortcuts.vdf and insert the value.

Some more testing needs to be done, and there is some potential to break out a couple of areas into separate functions, bbut functionally the PR is complete once I push my local changes. Major progress, really just testing and cleanup remains!

sonic2kk commented 9 months ago

Tested adding Non-Steam Games, setting the icon appears to still work.

sonic2kk commented 9 months ago

Shellcheck fiixes in place, this is probably ready for merging after a couple more tests...

sonic2kk commented 9 months ago

Add Non-Steam Game still works, getid/title still works, editing shortcut fields works, I think this is ready to merge! Testing and shellcheck are green and version is bumped. No langfile changes here.

The way we handle which column to edit in editSteamShortcutEntry is perhaps a little inefficient in that it uses a case statement, but eh, I think it's fine. It's for internal use only anyway, in future if there's demand it would be easy to expose on the commandline though.


I never did update the PR description but I think it's fine.