Created
December 31, 2025 08:37
-
-
Save VictorXLR/f9ce334d06546dd3e172f79b75af0d4e to your computer and use it in GitHub Desktop.
Steam Desktop Shortcut Icon Fixer for macOS - fetches proper game artwork from Steam and applies it to .app shortcuts
This file contains hidden or 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/bash | |
| # Steam Desktop Shortcut Icon Fixer for macOS | |
| # Fetches proper game artwork from Steam and applies it to .app shortcuts | |
| # Usage: ./steam-icon-fix.sh [game_name] [steam_app_id] | |
| # ./steam-icon-fix.sh --all (fixes known games) | |
| set -e | |
| DESKTOP="$HOME/Desktop" | |
| TEMP_DIR=$(mktemp -d) | |
| # Known Steam App IDs (game_name:app_id) | |
| KNOWN_GAMES=( | |
| "Cyberpunk 2077:1091500" | |
| "Disco Elysium:632470" | |
| "Frostpunk:323190" | |
| "Vampire Survivors:1794680" | |
| "Baldurs Gate 3:1086940" | |
| "Elden Ring:1245620" | |
| "Hades:1145360" | |
| "Stardew Valley:413150" | |
| "Hollow Knight:367520" | |
| "Celeste:504230" | |
| ) | |
| cleanup() { | |
| rm -rf "$TEMP_DIR" | |
| } | |
| trap cleanup EXIT | |
| fetch_and_apply_icon() { | |
| local game_name="$1" | |
| local app_id="$2" | |
| local app_path="$DESKTOP/${game_name}.app" | |
| if [[ ! -d "$app_path" ]]; then | |
| echo "โ ๏ธ Shortcut not found: $app_path" | |
| return 1 | |
| fi | |
| echo "๐ฎ Processing: $game_name (App ID: $app_id)" | |
| # Download Steam library capsule image (high quality) | |
| local img_url="https://steamcdn-a.akamaihd.net/steam/apps/${app_id}/library_600x900_2x.jpg" | |
| local fallback_url="https://steamcdn-a.akamaihd.net/steam/apps/${app_id}/header.jpg" | |
| local img_path="$TEMP_DIR/${app_id}.jpg" | |
| local png_path="$TEMP_DIR/${app_id}.png" | |
| local icns_path="$TEMP_DIR/${app_id}.icns" | |
| local iconset_path="$TEMP_DIR/${app_id}.iconset" | |
| # Try library capsule first, fall back to header | |
| if ! curl -sf "$img_url" -o "$img_path" 2>/dev/null; then | |
| echo " Trying fallback image..." | |
| if ! curl -sf "$fallback_url" -o "$img_path" 2>/dev/null; then | |
| echo "โ Failed to download artwork for $game_name" | |
| return 1 | |
| fi | |
| fi | |
| # Convert to PNG and create iconset | |
| sips -s format png "$img_path" --out "$png_path" >/dev/null 2>&1 | |
| mkdir -p "$iconset_path" | |
| # Generate all required icon sizes | |
| for size in 16 32 64 128 256 512; do | |
| sips -z $size $size "$png_path" --out "$iconset_path/icon_${size}x${size}.png" >/dev/null 2>&1 | |
| local size2x=$((size * 2)) | |
| if [[ $size2x -le 1024 ]]; then | |
| sips -z $size2x $size2x "$png_path" --out "$iconset_path/icon_${size}x${size}@2x.png" >/dev/null 2>&1 | |
| fi | |
| done | |
| # Create icns file | |
| iconutil -c icns "$iconset_path" -o "$icns_path" 2>/dev/null | |
| # Apply to app | |
| local resources_dir="$app_path/Contents/Resources" | |
| mkdir -p "$resources_dir" | |
| cp "$icns_path" "$resources_dir/shortcut.icns" | |
| # Clear icon cache for this app | |
| touch "$app_path" | |
| echo "โ Updated: $game_name" | |
| } | |
| fix_all_known() { | |
| echo "๐ง Fixing all known Steam shortcuts on Desktop..." | |
| echo "" | |
| local found=0 | |
| for entry in "${KNOWN_GAMES[@]}"; do | |
| local game_name="${entry%%:*}" | |
| local app_id="${entry##*:}" | |
| if [[ -d "$DESKTOP/${game_name}.app" ]]; then | |
| fetch_and_apply_icon "$game_name" "$app_id" && ((found++)) || true | |
| echo "" | |
| fi | |
| done | |
| if [[ $found -eq 0 ]]; then | |
| echo "No known game shortcuts found on Desktop." | |
| echo "Use: $0 \"Game Name\" STEAM_APP_ID" | |
| else | |
| echo "๐ Done! Fixed $found shortcut(s)." | |
| echo "" | |
| echo "๐ก If icons don't update immediately, run:" | |
| echo " killall Finder" | |
| fi | |
| } | |
| show_usage() { | |
| echo "Steam Desktop Shortcut Icon Fixer for macOS" | |
| echo "" | |
| echo "Usage:" | |
| echo " $0 --all Fix all known games" | |
| echo " $0 \"Game Name\" STEAM_APP_ID Fix a specific game" | |
| echo " $0 --list List known games" | |
| echo "" | |
| echo "Examples:" | |
| echo " $0 --all" | |
| echo " $0 \"Cyberpunk 2077\" 1091500" | |
| echo "" | |
| echo "Find Steam App IDs at: https://steamdb.info/" | |
| } | |
| list_known() { | |
| echo "Known games (add more to KNOWN_GAMES array):" | |
| echo "" | |
| for entry in "${KNOWN_GAMES[@]}"; do | |
| local game_name="${entry%%:*}" | |
| local app_id="${entry##*:}" | |
| printf " %-20s : %s\n" "$game_name" "$app_id" | |
| done | |
| } | |
| # Main | |
| case "${1:-}" in | |
| --all|-a) | |
| fix_all_known | |
| ;; | |
| --list|-l) | |
| list_known | |
| ;; | |
| --help|-h|"") | |
| show_usage | |
| ;; | |
| *) | |
| if [[ -z "${2:-}" ]]; then | |
| echo "Error: Steam App ID required" | |
| echo "Usage: $0 \"Game Name\" STEAM_APP_ID" | |
| exit 1 | |
| fi | |
| fetch_and_apply_icon "$1" "$2" | |
| echo "" | |
| echo "๐ก If icon doesn't update, run: killall Finder" | |
| ;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment