Run a script when entering/exiting a game

I think I might be overcomplicating things but for the life of me I can't seem to figure this out.

Bazzite installed in a SteamDeck OLED. I want to run a script when I execute a specific game and the same one with different parameters when I exit it. The purpose is some home automation stuff.

I thought "Okay, this shouldn't be hard". Checked $PATH and there's /home/<my-user>/.local/bin and also noticed that /home/deck is a symlink to /home/<my-user>. So I wrote a script that uses curl to send a payload and placed it there. Marked it as executable (and eventually just went full on 777) and tested it in the terminal. All good. Works.

Then I went to game mode -> Game -> Launch options -> script.sh true; %command%; script.sh false. But it doesn't do anything. The game launches yeah but the script doesn't seem to ever get executed, or at least I don't see the incoming webhook call on the other side.

Tried:
  • script.sh <value>
  • /home/<my-user>/.local/bin/script.sh <value>
  • /home/deck/.local/bin/script.sh <value>
  • ~/.local/bin/script.sh <value>
  • All of the above but with sh -c "examples above here".
Any hints on how I can troubleshoot this?.
Was this page helpful?