Last active
April 6, 2022 13:36
-
-
Save AeliusSaionji/02ca515231ea8a891a59097a631d0570 to your computer and use it in GitHub Desktop.
Steam Deck non-steam game shortcut maker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Creates shortcut ".desktop" files to facilitate easily adding non-steam games | |
# by Aelius | |
# NOTES | |
# Linux GOG games installed by GameHub create their own shortcuts | |
# This is not true for Heroic nor MiniGalaxy | |
# They attempt to create shortcuts, but currently not working in flatpak | |
# GameHub flatpak cannot currently install Windows games without innoextract | |
# So I'm using GameHub for linux GOG and win/linux itch.io | |
# Heroic for Windows GOG and Epic | |
# Script assumes Windows-only for Heroic installs | |
# Script assumes linux-only for itch.io installs | |
# Script assumes itch.io games are installed to ~/Games/itch (this is the default for GameHub) | |
# TODO | |
## Search for itch.io in default install location | |
## Search for linux installs in Heroic | |
## Search for Windows installs in itch GameHub | |
## Support minigalaxy | |
## Unique name per shortcut, in case there are multiple installs of the same game | |
gamesDir=$PWD | |
# Finds Windows games downloaded by Heroic launcher | |
cd $gamesDir/Heroic | |
for folder in *; do | |
# Exclude folder 'Prefixes' | |
if [ "$folder" = "Prefixes" ]; then continue; fi | |
# Include only folders | |
if [ ! -d "$folder" ]; then continue; fi | |
# Hope first match is right match | |
exec=$(find "$PWD/$folder" -maxdepth 1 -type f -iname '*.exe' -not -iname 'UnityCrashHandler*.exe' | head -n 1) | |
# Create shortcut, add name, exec | |
cat <<- desktopcontents > "$HOME/.local/share/applications/$folder.custom.desktop" | |
[Desktop Entry] | |
Name=$folder | |
Exec="$exec" | |
Comment=manually made desktop file | |
Terminal=false | |
Type=Application | |
Categories=Game; | |
desktopcontents | |
# Make executable | |
chmod +x "$HOME/.local/share/applications/$folder.custom.desktop" | |
done | |
cd $gamesDir/itch | |
for folder in *; do | |
# Include only folders | |
if [ ! -d "$folder" ]; then continue; fi | |
# Hope first match is right match | |
exec=$(find "$PWD/$folder" -maxdepth 1 -type f -iname '*x86_64' | head -n 1) | |
# Create shortcut, add name, exec | |
cat <<- desktopcontents > "$HOME/.local/share/applications/$folder.custom.desktop" | |
[Desktop Entry] | |
Name=$folder | |
Exec="$exec" | |
Comment=manually made desktop file | |
Terminal=false | |
Type=Application | |
Categories=Game; | |
desktopcontents | |
# Make executable | |
chmod +x "$HOME/.local/share/applications/$folder.custom.desktop" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment