chimera icon indicating copy to clipboard operation
chimera copied to clipboard

[Suggestion] Make steam-buddy manage Steam games

Open sharkwouter opened this issue 4 years ago • 4 comments

Introduction

Kind of obvious, you probably already came up with this idea. I was thinking steam-buddy could be used to install and uninstall steam games and restart steam to apply shortcuts. It could also show your library in a nice overview.

I've done a bit of research into what we'll need to be able to offer this.

Useful files

I've found that the following files contain information we'd need:

  • ~/.steam/steam/userdata/*/config/localconfig.vdf contains all the games the user owns under "Software" -> "Valve" -> "Steam" -> "Apps". It only contains the steam app id, playtime in minutes and when the game was last played.
  • ~/.steam/steam/config/loginusers.vdf contains all the users who have logged in to the system and their account name. This could be useful if we'd want to connect up with any APIs.
  • ~/.steam/registry.vdf contains all currently installed games and if they are currently updating. It will also show games as updating if they are currently being installed. It includes names, but not for everything that is installed.
  • The ~/.steam/steam/config/avatarcache directory contains the avatar of the user, which is a png file.

Missing pieces

The information found in these files is almost enough to show everything we need. The only things missing are names for games and thumbnails. Valve has an API which can gives a list of all application names, which can be found here. For the thumbnails we can probably use the thumbnails from Steam which are already being cached by steam-tweaks.

Controlling Steam

Now the final missing piece is how we could manage Steam. This can be done with by sending commands to steam from the command line as the user which is currently running steam. I found this out by looking at the steamkillall.sh script in SteamOS ~~which makes Steam kill itself (and restart, because lightdm will restart it). We could use this as well:~~

#!/bin/sh

touch /tmp/hkkillfile
steam steam://hkkillall

Edit: Steam doesn't respond to this script anymore, so instead we now just use the pkill command to stop Steam.

Installing applicaitons can be done in a similar way by running steam steam://install/730 for CS:GO for instance. Uninstalling would be done with steam steam://uninstall/730. In steam big picture mode steam asks no questions when doing this, unlike in desktop mode. Applications can also be started with steam steam://run/730, but this might not be as useful. 730 can of course be replaced by any stream app id.

Closing comments

Sorry if this is a long post. We should probably discuss this before trying to implement it, but I wanted to make sure I had what I found written down somewhere we can use it.

sharkwouter avatar Nov 19 '19 20:11 sharkwouter

Yes, I was thinking about something like this as well. Thanks for doing the research.

I am not sure that showing the Steam games and installing them is all that useful. I can imagine being able to see download progress might be useful though.

I also recall the steam website and app being able to initiate a game install and monitor progress in the past, but last I looked I couldnt do this anymore.

alkazar avatar Nov 19 '19 21:11 alkazar

The page where you can install games is still available. Go to your profile and the to games. It does not allow you to install games with proton, though, and the API doesn't seem to be documented. We may be able to reverse engineer it, but we'd probably have to let users log in to the steam website then.

I think installing games could be useful if we implement authentication, some other security features and upnp. Then you can fully manage your GamerOS machine when you're not home through steam-buddy.

sharkwouter avatar Nov 19 '19 21:11 sharkwouter

There is some documentation for the other API here: https://partner.steamgames.com/doc/webapi_overview

sharkwouter avatar Nov 19 '19 21:11 sharkwouter

Stopping steam has been implemented. I've updated my post on how to do this, since the command which is found in the SteamOS script no longer works (not even on SteamOS).

sharkwouter avatar Nov 26 '19 13:11 sharkwouter