Jorisvandijk.com

Living on Linux

Game mode

I only play a single game, which is Skyrim. I do dabble with other games from time to time, but really Skyrim is the only game I always come back to. Playing this (or really any) game on Linux has become such an effortless experience since the advent of Proton. Most games you start from Steam will just run; no configuration or extra steps needed. Gaming on Linux has become an almost perfect experience.

That said, of course I have some pet peeves. For example, on my system I run the i3 window manager, which I like to style a certain way, which in turn means I also use Picom to attain said look. Picom is great, but also sucks up some system resources, which translates to losing some fps in-game. Another minor annoyance is getting notifications while playing a game. I'd like to be immersed and not be bothered while fighting dragons and bandits.

Wouldn't it be great to just kill Dunst and disable notifications while playing my game, but then also re-enable both when done playing? Well, that's what this script does:

#!/usr/bin/env bash

# GameMode 1.1
# Kill Picom while playing a game.
# Dependencies: picom, dunst
#
# By Joris van Dijk | Jorisvandijk.com
# Licensed under the GNU General Public License v3.0

killall picom
dunstctl set-paused toggle

"$@"

picom &
dunstctl set-paused toggle &

And the way to use this script is to open steam, right click the game you're wanting this for (Skyrim in my case) and selecting Properties....

Steam

Then in the window that opens up, under the General tab in the Launch Options text field add the following:

[Location of script]/GameMode %command%

Where [Location of script] is the path to where you save the GameMode script. Next time you launch the game the script will run, kill Picom and disable Dunst. When the game is closed the script will start Picom again and re-enable Dunst.