popsUlfr / SDH-PauseGames

Decky Loader Plugin for Steam Deck to Pause and Resume games
GNU General Public License v3.0
76 stars 8 forks source link

Pause on steam overlay functionality #3

Closed therealpaulgg closed 1 year ago

therealpaulgg commented 1 year ago

Hi,

I was wondering, as an extension of the 'pause on focus loss', would it be possible to have a feature that when the STEAM button is pressed and the overlay is brought up, the game is suspended? The game would also be paused when browsing the library, or friends tab, etc.

The main idea behind this is there are several games (singleplayer, emulated) that won't automatically pause themselves. It would be desirable to have them auto-pause and unpause when pressing the STEAM button, similar to pressing the Home button on the nintendo switch.

I don't have any experience developing decky plugins but do know JS/TS/react and I'd be happy to contribute to make this happen...was looking here. Specifically the steam overlay is mentioned but I'm unsure if this would even be possible to accomplish or not.

therealpaulgg commented 1 year ago

If you are interested, I implemented this feature on a separate fork. https://github.com/therealpaulgg/SDH-PauseGames/commit/2ff05251139c363a082b6e39a174a1f9ad57c522

popsUlfr commented 1 year ago

In my first iteration for the "Pause on focus loss" feature I experimented with this but there are edge cases that would have made it annoying or potentially break some use cases. Like using a STEAM + other button combination to take a screenshot, magnify the screen etc where you don't want to stop the application. Or a launcher downloading game assets, steamworks subscriptions processing additional content, any instance you just want to look something up or change the controller layout without outright wanting to put the application to sleep. Potential Steam Overlay and Quick Access Menu shenanigans. I'm not saying it's impossible of course just that there were many pitfalls in my eyes to get it working right without needing to invest a lot of time and testing + the fact that Valve likes to change the behaviour of the client api that the plugins rely on frequently.

As a separate feature it has its chances though, thank you for looking into this. It might make sense to put it as a sub-option to the "Pause on focus loss" feature since it would be a more "aggressive" version of it ?

If you feel like you have something that works or a draft don't hesitate to submit a pull request I'll try to test it on my end :)

therealpaulgg commented 1 year ago

https://github.com/popsUlfr/SDH-PauseGames/pull/4

Interesting edge cases you mentioned. I don't know how many of them are resolved by the approach I took (I know screenshots at least work) but it uses a combination of the STEAM button System key event as well as a focus change event. It requires both to pause the game.