Rolv-Apneseth / rofi-games

A rofi plugin which adds a mode that will list available games for launch along with their box art. Requires a good theme for the best results.
GNU General Public License v2.0
57 stars 1 forks source link

Location of box art for Steam Shortcuts #26

Closed HelmicNewciv closed 1 month ago

HelmicNewciv commented 1 month ago

~/.stesam/steam/userdata/<userIDgoeshere>/config/grid has the box art images for non-Steam games, and ~/.stesam/steam/userdata/<userIDgoeshere>/config/shortcuts.vdf has the shortcut information.

Rolv-Apneseth commented 1 month ago

Oh nice, thanks. It being based off the user ID is probably not ideal though. Do you know of any file that the currently logged in user ID can be read from?

Rolv-Apneseth commented 1 month ago

Could check all those sub directories of userdata to find a user ID I suppose but again that doesn't seem ideal

HelmicNewciv commented 1 month ago

Yeah, most people using this are probably only using a single Steam account, so it's probably acceptable as a limitation for the time being. I don't use a machine with multiple Steam logins so I can't really test its behavior, but what actually would happen if you just added all (unique) shortcuts from all acounts and just launched it? Would Steam ask you to log into hte other account, not doing anything, or just launch the game?

Rolv-Apneseth commented 1 month ago

Good question - I don't have multiple accounts either. Like you said I would guess most people only have one account logged in, but I can implement it like that anyway and then hopefully someone can open an issue if they come across it. Thanks again for opening this, I'll come back when I have some time to implement it

Rolv-Apneseth commented 1 month ago

Just looking into this now - that shortcuts.vdf file is just a file with binary data:

$ file -i shortcuts.vdf
> shortcuts.vdf: application/octet-stream; charset=binary

Do you know of any other place where info about the non-Steam games can be found? I've had a look again but couldn't find anything. To get the ID of the non-Steam game, I created a desktop shortcut, and searching for that yielded no results. The name of the image files seem to be unrelated.

HelmicNewciv commented 1 month ago

When I looked at the binary data in a hex editor, I could see that the shortcut ID matched the filename of the image. I would bet that Steam ROM Manager already has this figured out, given that's how people generally add box art to their emulated games in Steam.

Rolv-Apneseth commented 1 month ago

Ah thank you, that led me down the right path. Didn't know about that program.

They use this JS library for parsing and editing the shortcuts file, which led me to think that would be nice to have in Rust and thought I might have to port some of the functionality. Thankfully, someone already created steam_shortcuts_util so hopefully that works and I'll come back when I'm done.

Rolv-Apneseth commented 1 month ago

Added support for Steam shortcuts in the latest version there, let me know if it works for you

Rolv-Apneseth commented 1 month ago

Closing, but if you have issues lmk and we can re-open. Thanks again for the help.

HelmicNewciv commented 1 month ago

Yep, updated and it pulled up instantly, works great. I would note that since this doesn't actually write to shortcuts.vdf, restarting shouldn't be necessary... unless the user is using a tool like Steam ROM Manager that does write to shortcuts.vdf to handle their box art.

It's a somewhat moot distinction at present as most people aren't going to sit there and add box art manually through the Steam client, but I imagine there's a crate or something that would be able to handle making filler box art just listing the application name to handle shortcuts without any box art, at which point a user could just add a non-Steam game directly in the steam client and then have that instantly appear it rofi-games.

Thanks for this great tool, hitting meta+G to play video games has been great for actually deciding to go play a video game instead of feeling too exhausted to navigate Steam's interface.

Rolv-Apneseth commented 1 month ago

restarting shouldn't be necessary

Thanks for letting me know as I did not test it out just assumed since the library suggested it I should too

I imagine there's a crate or something that would be able to handle making filler box art just listing the application name to handle shortcuts without any box art

Technically I could just show the entries with no images, just feels like it goes against the point of this. I'll maybe think about some default box art so that entries with no icon can at least be launched with no extra effort.

Thanks for this great tool, hitting meta+G to play video games has been great for actually deciding to go play a video game instead of feeling too exhausted to navigate Steam's interface

No problem. And yeah that's the main reason I wanted something like this in the first place