From fbdad5a785b8796171dd19f633a9892a485e9fd6 Mon Sep 17 00:00:00 2001 From: Rick Peters Date: Fri, 2 Oct 2026 09:28:03 +0200 Subject: [PATCH] feat: the silent option is Steam's own autostart entry (~/.config/autostart/steam.desktop with -silent), so its "Run Steam when my computer starts" follows it; the systemd unit is gone --- CHANGELOG.md | 2 +- TECHNICAL.md | 12 ++++--- lib/steam-desktop.sh | 43 ++++++++++++++++-------- lib/steam-game.sh | 8 ++--- services/README.md | 1 - services/steam-desktop-autostart.service | 15 --------- 6 files changed, 39 insertions(+), 42 deletions(-) delete mode 100644 services/steam-desktop-autostart.service diff --git a/CHANGELOG.md b/CHANGELOG.md index 849beb6..11c165b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ one per merged pull request. ## 2.11.0 - 2026-10-01 -- `5da1833` **feat: "Start Steam silently" sub-option: under the SteamOS conversion (`silent`, on by default, as before) and under Gaming on NVIDIA (`nvsilent`, opt-in, not together with Big Picture); the SteamOS one is called "Start Steam silently in desktop mode" and is always shown, also on a Steam Machine** +- `5da1833` **feat: "Start Steam silently" sub-option: under the SteamOS conversion (`silent`, on by default, as before) and under Gaming on NVIDIA (`nvsilent`, opt-in, not together with Big Picture); the SteamOS one is called "Start Steam silently in desktop mode" and is always shown, also on a Steam Machine; it is Steam's own autostart entry (`~/.config/autostart/steam.desktop`), so Steam's setting "Run Steam when my computer starts" follows it** ## 2.10.0 - 2026-10-01 diff --git a/TECHNICAL.md b/TECHNICAL.md index a77c966..dde3e2b 100644 --- a/TECHNICAL.md +++ b/TECHNICAL.md @@ -109,8 +109,10 @@ tools write to the conf.d fragment into the base config. installs `/usr/local/bin/sync-steamos-session.sh` plus `sync-steamos-session.path`/`.service`; - `KWIN_IM_SHOW_ALWAYS=1` for the virtual keyboard; the sub-option `silent` - ("Start Steam silently in desktop mode", on by default, always shown) adds a `steam-desktop-autostart` - systemd user service that starts Steam silently in Plasma only; + ("Start Steam silently in desktop mode", on by default, always shown) writes + `~/.config/autostart/steam.desktop` (the system steam.desktop with `-silent` in its Exec line). That is the + file Steam's own setting "Run Steam when my computer starts" creates and removes, so the setting shows it. An older + `steam-desktop-autostart` user unit is removed; - the **Return to Gaming Mode** shortcut; on plasma-login-manager with a narrow sudoers rule (`/etc/sudoers.d/gamescope-session-switch`) so it can restart the login manager without a password prompt. @@ -344,8 +346,7 @@ desktop through its desktop layout (A = Enter, B = Esc, Y = Space, X = Steam's keyboard), in gaming mode as a gamepad. Steam reads the list only at startup and writes it back on exit, so Steam is -closed (`steam -shutdown`) for the edit and started again (through -`steam-desktop-autostart.service` when it's there). That's refused in gaming +closed (`steam -shutdown`) for the edit and started again (`steam -silent`). That's refused in gaming mode and when Steamify itself was started from Steam (`SteamGameId`), since closing Steam would end it. An entry for the start script that's already there (added by hand, or with the path from before 2.5.0) is updated, not @@ -490,7 +491,8 @@ In the home folder, everything is under `steamify`: | `~/.local/share/steamify/bin/` | The shortcut's start scripts (`run-app`, `run-wizard`) and `steamify-notifier` | | `~/.local/share/icons/hicolor/scalable/apps/steamify.svg` | The shortcut's icon | | `~/.local/share/applications/steamify-*.desktop` | The launcher entries | -| `~/.config/systemd/user/` | `steamify-update-check.*`, `steam-desktop-autostart.service` | +| `~/.config/autostart/steam.desktop` | the `silent` option (Steam's "Run Steam when my computer starts") | +| `~/.config/systemd/user/` | `steamify-update-check.*` | System-wide: `/usr/local/lib/steamify/` (kernel headers script), `/usr/src/steamify-*` (DKMS modules), `/var/cache/steamify/kernel` (the old diff --git a/lib/steam-desktop.sh b/lib/steam-desktop.sh index 641c5ec..5026856 100644 --- a/lib/steam-desktop.sh +++ b/lib/steam-desktop.sh @@ -16,34 +16,49 @@ steam_enable() { } # Sub-option of the SteamOS conversion: Steam starts silently (in the tray, -# no window) on the Plasma desktop. +# no window) on the Plasma desktop. It is Steam's own autostart entry, the file +# Steam's setting "Run Steam when my computer starts" creates and removes, so +# that setting shows what Steamify did (and the other way around). Steam's copy +# is the system steam.desktop; ours has -silent in its Exec line. +STEAM_AUTOSTART="${XDG_CONFIG_HOME:-$HOME/.config}/autostart/steam.desktop" +STEAM_SYSTEM_DESKTOP=/usr/share/applications/steam.desktop + silent_status() { - [[ -f "$HOME/.config/systemd/user/steam-desktop-autostart.service" ]] + grep -qs '^Exec=.*-silent' "$STEAM_AUTOSTART" +} + +silent_old_unit_remove() { + # Before 2.11.0 the option was a systemd user unit: it would start Steam a second time. + local unit="$HOME/.config/systemd/user/steam-desktop-autostart.service" + [[ -f "$unit" ]] || return 0 + user_systemctl disable --now steam-desktop-autostart.service 2>/dev/null + rm -f "$unit" + user_systemctl daemon-reload } silent_enable() { - local systemd_user_dir="$HOME/.config/systemd/user" - mkdir -p "$systemd_user_dir" - service_file steam-desktop-autostart.service > "$systemd_user_dir/steam-desktop-autostart.service" - # Clean out old .desktop shortcut so they don't fight - rm -f "$HOME/.config/autostart/steam.desktop" - user_systemctl daemon-reload - user_systemctl enable --now steam-desktop-autostart.service - ok "Steam starts silently on the desktop." + silent_old_unit_remove + mkdir -p "$(dirname "$STEAM_AUTOSTART")" + if [[ -f "$STEAM_SYSTEM_DESKTOP" ]]; then + sed 's|^Exec=/usr/bin/steam %U$|Exec=/usr/bin/steam -silent %U|' "$STEAM_SYSTEM_DESKTOP" > "$STEAM_AUTOSTART" + fi + silent_status || printf '%s\n' '[Desktop Entry]' 'Name=Steam' 'Exec=/usr/bin/steam -silent %U' \ + 'Icon=steam' 'Terminal=false' 'Type=Application' 'Categories=Network;FileTransfer;Game;' > "$STEAM_AUTOSTART" + ok "Steam starts silently on the desktop from the next login." } silent_disable() { - user_systemctl disable --now steam-desktop-autostart.service 2>/dev/null - rm -f "$HOME/.config/systemd/user/steam-desktop-autostart.service" - user_systemctl daemon-reload + silent_old_unit_remove + silent_status && rm -f "$STEAM_AUTOSTART" ok "Steam no longer starts by itself on the desktop." } steam_disable() { info "Removing Steam desktop settings..." - # The autostart unit is the `silent` option's: removed with it, and here + # The autostart entry is the `silent` option's: removed with it, and here # too for when the conversion goes off by itself. silent_status && silent_disable + silent_old_unit_remove rm -f "$HOME/.config/environment.d/99-kde-virtual-keyboard.conf" ok "Steam desktop settings removed (takes full effect at next login)." } diff --git a/lib/steam-game.sh b/lib/steam-game.sh index ff85c82..7b628ca 100644 --- a/lib/steam-game.sh +++ b/lib/steam-game.sh @@ -56,7 +56,7 @@ steamgame_steam_busy() { steamgame_edit() { # steamgame_edit : runs it with Steam closed, then starts Steam - # again if it was running (through our autostart unit when that's there). + # again if it was running (silently, in the tray). local was_running=false i if pgrep -x steam >/dev/null; then steamgame_steam_busy && return 1 @@ -72,11 +72,7 @@ steamgame_edit() { fi "$1"; local rc=$? if [[ "$was_running" == true ]]; then - if user_systemctl is-enabled -q steam-desktop-autostart.service 2>/dev/null; then - user_systemctl start steam-desktop-autostart.service - else - systemd-run --user --collect -q steam -silent >/dev/null 2>&1 - fi + systemd-run --user --collect -q steam -silent >/dev/null 2>&1 info "Steam is starting again." fi return "$rc" diff --git a/services/README.md b/services/README.md index 3ffd152..e13c69e 100644 --- a/services/README.md +++ b/services/README.md @@ -12,6 +12,5 @@ in the shell code. | `steamify-boot-desktop.service` | `lib/boot-session.sh` (Boot into: desktop) | Sets the Plasma session before the login manager starts | | `sync-steamos-session.path`, `.service` | `lib/login-manager.sh` (SteamOS conversion, plasma-login-manager) | The sync bridge: copies Steam's session choice into `plasmalogin.conf` | | `steamify-steam-autostart.service` | `lib/nvidia.sh` (Gaming on NVIDIA) | Steam at login on the Plasma desktop, normal or in Big Picture (user unit) | -| `steam-desktop-autostart.service` | `lib/steam-desktop.sh` (SteamOS conversion) | Steam in the background on the Plasma desktop (user unit) | | `ensure-kernel-headers.service` | `lib/steam-machine.sh` (Steam Machine support) | Installs missing kernel headers at boot, so DKMS builds for every kernel | | `steamify-update-check.service`, `.timer` | `lib/update-notifier.sh` (Update notifications) | The daily and login check for a new release (user units) | diff --git a/services/steam-desktop-autostart.service b/services/steam-desktop-autostart.service deleted file mode 100644 index b1c3323..0000000 --- a/services/steam-desktop-autostart.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Steam Background Autostart for Virtual Keyboard -After=graphical-session.target -PartOf=graphical-session.target - -[Service] -Type=simple -# Only in the Plasma desktop session; gamescope-session starts its own Steam. -ExecCondition=/bin/sh -c '[ "$XDG_CURRENT_DESKTOP" = KDE ]' -ExecStart=/usr/bin/steam -silent -Restart=on-failure -RestartSec=5 - -[Install] -WantedBy=graphical-session.target