Description

I've written a short bash script to suspend and resume a game process using a hotkey (using 'kill -STOP/-CONT <pid>').


#!/bin/bash

if [ "$1" == "init" ]; then
  touch /tmp/scummvm-running 
  exit 0
fi

pid=$(ps aux|grep -i steam|grep "steamapps/common/Broken Sword"|grep -v reaper|grep -v grep|awk '{print $2}')
if [ -e /tmp/scummvm-running ]; then
  kill -STOP $pid
  rm /tmp/scummvm-running
  echo stopped
else
  kill -CONT $pid
  touch /tmp/scummvm-running 
  echo continued
fi

I find it useful to be able to interrupt a game process (mainly for text output, i.e subtitles) when trying to improve your language skills by playing games like adventures in a language you're currently learning. It's a bit like watching movies/series, just with more interaction and possibly having even more fun (if you like games; and yes I know: many don't).

Goals

Get this running on my freshly bought Steam Deck using one of its buttons instead of a keyboard shortcut. It shouldn't be that hard, since Steam Deck is already running Linux (SteamOS based on Arch Linux).

Resources

Obviously you need a Steam Deck and some docking station for it for connecting a USB keyboard for testing, so you can begin testing with keyboard shortcuts, then buttons on the Steam Deck itself.

Outcome/Results (Friday afternoon)

After figuring out how to ssh into this Linux machine (configure password for 'deck' user; enable Developer mode in Steam Deck configuration; enable and start sshd by using sudo command) I could copy my script to the Steam Deck and configure a keyboard shortcut to this script in Steam Deck's KDE desktop. With that I can easily suspend and resume my game using the connected USB keyboard.

Then I tried to configure a button on the Steam Deck instead of a keyboard shortcut to trigger running the script. Unfortunately pressing this button gets ignored for some reason, although the appropriate button isn't used at all in the game. Not sure what's happening here ...

Pictures

Here you find a picture of the hardware setup.

Looking for hackers with the skills:

Nothing? Add some keywords!

This project is part of:

Hack Week 25

Activity

  • about 9 hours ago: sndirsch originated this project.

  • Comments

    • eminguez
      about 7 hours ago by eminguez | Reply

      Have you seen this just in case? https://github.com/popsUlfr/SDH-PauseGames

      • sndirsch
        about 7 hours ago by sndirsch | Reply

        Not at all. Thanks for the hint!

        • sndirsch
          about 6 hours ago by sndirsch | Reply

          Seems the main feature, i.e. hotkey support has not (yet) been implemented by this project. :-( I'm interested in pausing the game via hotkey, not switching between games.

    Similar Projects

    This project is one of its kind!