How to launch Steam games using Rofi

September 30, 2021

I recently figured out how to launch my Steam games from the shell today. This means that I can now start my games via my application launcher Rofi.


Start by right-clicking on a game in your Steam library. It will then create a .desktop-file with that game in the folder ~/.var/app/com.valvesoftware.Steam/Desktop/.

In that file, there’s a line that looks like this:

Exec=steam steam://rungameid/<ID>

Using that ID, you can then launch the game using this command:

com.valvesoftware.Steam steam://rungameid/<ID>

If you use Flatpak:

flatpak run com.valvesoftware.Steam steam://rungameid/<ID>

With all that prepared. You can now use this Rofi plugin that I created:


DIR="/home/$( whoami )/.var/app/com.valvesoftware.Steam/Desktop"

handle_selection() {
  if [ "$1" ]; then
    ID="$(grep -oP '(?<=rungameid/).*' "$DIR"/"$1".desktop)"
    flatpak run com.valvesoftware.Steam steam://rungameid/"$ID" 
    notify-send "Steam" "Launching the game \"$1\""

handle_selection "$( cd "$DIR" || exit; ls -t  | sed 's/\.desktop//' | rofi -dmenu -i -p 'Launch game' -hlbg '#5FA5D7' -bc '#5FA5D7' -bw 3)"


No Comments

Use the e-mail form, if you wish to leave feedback for this post. Markdown is supported. [Terms of service]