Skip to content

Add action "add-to-steam@chmodmasx"#757

Open
chmodmasx wants to merge 4 commits intolinuxmint:masterfrom
chmodmasx:master
Open

Add action "add-to-steam@chmodmasx"#757
chmodmasx wants to merge 4 commits intolinuxmint:masterfrom
chmodmasx:master

Conversation

@chmodmasx
Copy link
Copy Markdown
Contributor

Add to Steam (Nemo Action)

Add non-Steam games to your Steam library from the Nemo (Cinnamon) context menu.

  • UUID: add-to-steam@chmodmasx
  • Author: chmodmasx
  • Supports: Steam .deb and Steam Flatpak
  • Requires: Steam running

Usage:

  • Right-click a .desktop, .AppImage, .exe, or an executable .sh/.py and choose "Add to Steam".

@mtwebster
Copy link
Copy Markdown
Member

/review-action

@mtwebster
Copy link
Copy Markdown
Member

Nemo Action Review (Automated)

This is an automated review generated by Claude. It may contain inaccuracies — maintainers should verify any findings.

The background agent caught an additional critical bug I need to add. Here is the complete consolidated review ready to post:


Thanks for submitting this action! The concept is great — a right-click shortcut to add non-Steam games is something many users will appreciate. There are several issues to address before this can be merged.


Critical

((var++)) arithmetic with set -euo pipefail causes the script to abort on the first file

add-to-steam.sh lines 97 and 99:

((success_count++))
...
((fail_count++))

In bash, ((expr)) returns exit code 1 when the expression evaluates to 0 (i.e., false). With success_count=0, ((success_count++)) pre-increments — the expression value is 0, so the exit code is 1. Under set -e, this kills the script immediately after the first successful file. The script never works correctly when processing files. Fix with:

success_count=$((success_count + 1))
fail_count=$((fail_count + 1))

Or append || true to each arithmetic statement.


Dependencies field will prevent the action from loading for most users

The action definition lists:

Dependencies=python3;steam;flatpak;xdg-open;zenity;notify-send;

Nemo requires all listed dependencies to be present in PATH at load time, or the action silently won't appear. This breaks the action for the most common scenarios:

  • User with native (deb) Steam only → flatpak not in PATH → action doesn't load
  • User with Flatpak Steam only → steam not in PATH → action doesn't load
  • User without zenity or notify-send → action doesn't load (even though the script already handles these being absent with fallbacks)

The Dependencies field should only list programs that are truly, unconditionally required. The minimum correct value is:

Dependencies=python3;

All user-facing strings are hardcoded in Spanish

Every runtime message in the script is in Spanish: "Archivo no encontrado", "Steam debe estar en ejecución", "ha sido añadido a Steam", "Tipo de archivo no soportado", "Procesados/Exitosos/Fallidos", etc. This is a community action distributed to all Cinnamon users. The default language for scripts should be English. You're welcome to keep the Spanish .po translation — but the strings in the script itself need to be in English.


Important

/tmp/addnonsteamgamefile is dead code and a security issue

add-to-steam.sh line 11:

touch /tmp/addnonsteamgamefile 2>/dev/null || true

This file is created but never read, written, or used anywhere in the script — it's vestigial behavior cargo-culted from older Steam workarounds. It also uses a world-writable, predictable path, making it vulnerable to symlink attacks from local processes. Remove it entirely.


add_to_steam() always returns 0, making Steam launch failures silent

Every branch in add_to_steam() uses || true and ends with return 0. The caller checks if add_to_steam "$file" and would increment fail_count on failure — but this branch is unreachable. If Steam fails to handle the URL, the user still gets a success notification. Consider propagating real failure status, or at least removing the misleading success notification in cases where the outcome is unknown.


Missing Quote field — filenames with spaces will break

Exec=<add-to-steam@chmodmasx/add-to-steam.sh %F>

Without a Quote field, %F expands file paths without any escaping. A file named My Game.sh arrives at the script as two separate arguments My and Game.sh. Add:

Quote=double

Minor

flatpak run hardcodes --arch=x86_64

setsid flatpak run --branch=stable --arch=x86_64 com.valvesoftware.Steam "$encoded_url"

This silently fails on ARM systems. The --arch and --branch flags are unnecessary — flatpak run com.valvesoftware.Steam "$encoded_url" is simpler and portable.


xdg-open fallback is logically unreachable

The else branch in add_to_steam() calls xdg-open "$encoded_url" when neither steam nor flatpak is found. But verify_steam_running() already confirmed Steam is running before add_to_steam() is ever called — so this fallback would only trigger in an impossible state (Steam running but not launchable). This code path should be reviewed for correctness.


Version mismatch

metadata.json declares "version": "1.0.0" but po/add-to-steam@chmodmasx.pot says Project-Id-Version: add-to-steam@chmodmasx 2.0. These should match.


Strengths

  • Good overall script structure: set -euo pipefail, proper use of local, all variables quoted, clean separation of concerns between validate_file, verify_steam_running, add_to_steam, and main.
  • Supporting both native and Flatpak Steam via runtime detection is the right approach.
  • Using the steam://addnonsteamgame/ URL protocol is correct.
  • The MIME-type validation in validate_file is thorough.
  • Multi-file selection with a summary is a nice touch.

Automated review of 3b61a72 — last updated 2026-02-21 21:15 UTC

chmodmasx and others added 2 commits February 28, 2026 15:47
- Fix bash arithmetic error with 'set -e'
- Translate hardcoded runtime strings to English
- Change Dependencies to only strictly require python3
- Remove predictable /tmp file creation
- Add Quote=double for correct handling of files with spaces
- Remove hardcoded --arch=x86_64 for flatpak fallback
- Clean up unreachable xdg-open code path
- Sync versions to 1.0.1 across metadata and po files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants