diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a04062..c5a25c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ one per merged pull request. ## 2.9.7 - 2026-10-01 -- **feat: "Gaming on NVIDIA" (nvidia) replaces the SteamOS conversion on PCs with an NVIDIA GPU, where gamescope's gaming mode shows a corrupted picture (NVIDIA bug 5240452): Steam is installed when missing and starts at login on the Plasma desktop; the sub-option "Steam starts in Big Picture" (bigpicture, ticked along with it) starts it in Big Picture, unticked in its normal window (lib/nvidia.sh, services/steamify-steam-autostart.service). On a supported card (RTX 20 series or newer, chwd's legacy lists like the VRAM booster) it also puts nvidia-drm.modeset=1 and fbdev=1 on the kernel command line (Limine incl. its `+=` line, systemd-boot, GRUB) and the NVIDIA modules in the initramfs while every installed kernel has them (a pacman hook decides at every kernel change). The conversion and its options are hidden there unless already on** +- **feat: "Gaming on NVIDIA" (nvidia) replaces the SteamOS conversion on PCs with an NVIDIA GPU, where gamescope's gaming mode shows a corrupted picture (NVIDIA bug 5240452): Steam is installed when missing and starts at login on the Plasma desktop; the sub-option "Steam starts in Big Picture" (bigpicture, ticked along with it) starts it in Big Picture, unticked in its normal window, and Big Picture starts on an empty Plasma session (no windows of the last session on top of it) (lib/nvidia.sh, services/steamify-steam-autostart.service). On a supported card (RTX 20 series or newer, chwd's legacy lists like the VRAM booster) it also puts nvidia-drm.modeset=1 and fbdev=1 on the kernel command line (Limine incl. its `+=` line, systemd-boot, GRUB) and the NVIDIA modules in the initramfs while every installed kernel has them (a pacman hook decides at every kernel change). The conversion and its options are hidden there unless already on** - **feat: single user mode also works on NVIDIA PCs, without the SteamOS conversion: it switches to SDDM and logs in to the Plasma session by itself (/etc/sddm.conf.d/zzz-steamify-autologin.conf), and no longer ticks the conversion where that isn't offered (lib/single-user.sh)** - **test: tests/nvidia-test.sh runs it against a fake RTX 5080 beside an iGPU, a stub pacman and systemctl, and a temp home (no root, VM or hardware); verified on a real RTX 5080: gamescope's session, a nested gamescope and a KWin-only session all showed artifacts or stutter, Big Picture on the Plasma desktop did not** diff --git a/TECHNICAL.md b/TECHNICAL.md index 91e48fc..dc56f8b 100644 --- a/TECHNICAL.md +++ b/TECHNICAL.md @@ -228,8 +228,9 @@ conversion (`gaming`, and its options `boot`, `single`, `glyphs`) isn't offered, off). `nvidia` ("Gaming on NVIDIA", `lib/nvidia.sh`) takes its place, hidden while the conversion is on (both would start Steam at login): it installs `steam` when missing (recorded in state `nvidia`, removed again only then) and enables the user unit `steamify-steam-autostart.service` (`services/`, `ExecStart=/usr/bin/steam @ARGS@`, Plasma only). Its sub-option -`bigpicture` ("Steam starts in Big Picture", ticked along with it) rewrites the unit with `-gamepadui`; unticked, Steam -starts in its normal window. The PC always boots into the desktop: there is no gamescope session. Takes effect at the next +`bigpicture` ("Steam starts in Big Picture", ticked along with it) rewrites the unit with `-gamepadui` and sets +`ksmserverrc [General] loginMode=emptySession` (`kset`, undone with `krevert bigpicture`), so windows of the last session +(Discord, a browser) aren't restored on top of Big Picture; unticked, Steam starts in its normal window. The PC always boots into the desktop: there is no gamescope session. Takes effect at the next login. On a supported card (RTX 20 series or newer: not on chwd's legacy lists `/var/lib/chwd/ids/nvidia-*.ids`, the VRAM booster's diff --git a/lib/nvidia.sh b/lib/nvidia.sh index dd42053..e624e2b 100644 --- a/lib/nvidia.sh +++ b/lib/nvidia.sh @@ -74,6 +74,7 @@ nvidia_disable() { # shellcheck disable=SC2086 # a list of package names [[ -n "$pkgs" ]] && sudo pacman -Rns --noconfirm $pkgs >/dev/null 2>&1 state_clear nvidia + krevert bigpicture nvidia_kernel_disable ok "Steam no longer starts at login." } @@ -83,10 +84,14 @@ bigpicture_status() { grep -qs -- '-gamepadui' "$(nvidia_unit_file)"; } bigpicture_enable() { # The unit comes from nvidia_enable (it runs first); without it there is nothing to change. [[ -f "$(nvidia_unit_file)" ]] || return 0 - nvidia_write_unit -gamepadui && ok "Steam starts in Big Picture at your next login." + nvidia_write_unit -gamepadui || return 1 + # Windows of the last session (Discord, a browser) would be restored on top of Big Picture. + kset bigpicture ksmserverrc General loginMode emptySession + ok "Steam starts in Big Picture at your next login, on an empty desktop." } bigpicture_disable() { + krevert bigpicture [[ -f "$(nvidia_unit_file)" ]] || return 0 nvidia_write_unit "" && ok "Steam starts in its normal window at your next login." } diff --git a/tests/nvidia-test.sh b/tests/nvidia-test.sh index 4af3cf3..c157ade 100644 --- a/tests/nvidia-test.sh +++ b/tests/nvidia-test.sh @@ -12,8 +12,19 @@ source lib/common.sh; source lib/state.sh; source lib/login-manager.sh; source l # Runs as the user, and refuses anything under the real system folders: a test must never touch them. sudo() { local a; for a in "$@"; do case "$a" in /etc/*|/usr/*|/boot/*|/var/*) echo "REFUSED sudo $*" >&2; return 1 ;; esac; done; "$@"; } info() { :; }; ok() { :; }; warn() { :; }; err() { echo "ERR $*"; } -kwriteconfig6() { local f g k v; while [[ $# -gt 0 ]]; do case "$1" in --file) f="$2";; --key) k="$2";; esac; [[ $# -ge 2 ]] && v="$2"; shift; done; printf '%s=%s\n' "$k" "$v" > "$f"; } -kreadconfig6() { local f k; while [[ $# -gt 0 ]]; do case "$1" in --file) f="$2";; --key) k="$2";; esac; shift; done; sed -n "s/^$k=//p" "$f" 2>/dev/null; } +# KDE's config tools on plain files under the temp home (a relative file name is relative to ~/.config, as in KDE). +kwriteconfig6() { + local f="" k="" v="" del=0 + while [[ $# -gt 0 ]]; do case "$1" in --file) f="$2"; shift ;; --key) k="$2"; shift ;; --group) shift ;; --delete) del=1 ;; *) v="$1" ;; esac; shift; done + [[ "$f" == /* ]] || f="$HOME/.config/$f"; mkdir -p "$(dirname "$f")" + if [[ $del == 1 ]]; then sed -i "/^$k=/d" "$f" 2>/dev/null; else sed -i "/^$k=/d" "$f" 2>/dev/null; printf '%s=%s\n' "$k" "$v" >> "$f"; fi +} +kreadconfig6() { + local f="" k="" d="" r + while [[ $# -gt 0 ]]; do case "$1" in --file) f="$2"; shift ;; --key) k="$2"; shift ;; --default) d="$2"; shift ;; --group) shift ;; esac; shift; done + [[ "$f" == /* ]] || f="$HOME/.config/$f" + r="$(sed -n "s/^$k=//p" "$f" 2>/dev/null)"; printf '%s\n' "${r:-$d}" +} # A pretend package database and systemd: what the tests assert on. PKGS=""; PACMAN_LOG="$T/pacman.log"; : > "$PACMAN_LOG"; ENABLED=0 pacman() { @@ -83,8 +94,10 @@ bigpicture_enable check "Big Picture: Steam starts with -gamepadui" 'grep -q "^ExecStart=/usr/bin/steam -gamepadui$" "$UNIT" && bigpicture_status' nvidia_enable check "turning Gaming on NVIDIA on again keeps Big Picture" 'bigpicture_status' +check "Big Picture: Plasma starts with an empty session" '[[ "$(kreadconfig6 --file ksmserverrc --group General --key loginMode)" == emptySession ]]' bigpicture_disable check "Big Picture off: Steam's normal window again" '! bigpicture_status && nvidia_status' +check "...and the session setting is back as it was (not set)" '[[ -z "$(kreadconfig6 --file ksmserverrc --group General --key loginMode)" ]]' # --- turning it off bigpicture_enable; nvidia_disable diff --git a/ui/qml/Texts.qml b/ui/qml/Texts.qml index a240fbf..c2f979d 100644 --- a/ui/qml/Texts.qml +++ b/ui/qml/Texts.qml @@ -15,7 +15,7 @@ QtObject { changes: ["Steam is installed when it's missing", "Steam starts at login (a systemd user service)", "Off: the service is removed again; Steam is only removed if Steamify installed it"] }, bigpicture: { label: "Steam starts in Big Picture", hint: "The controller-friendly Steam, or the normal window", body: "Steam opens in Big Picture at login, which works well with a controller on the TV. Untick it for Steam's normal window.", - changes: ["Steam is started with -gamepadui", "Off: Steam starts in its normal window"] }, + changes: ["Steam is started with -gamepadui", "Plasma starts with an empty session, so old windows don't cover Big Picture", "Off: Steam starts in its normal window"] }, theme: { label: "SteamOS theme", hint: "Vapor look for the desktop, Add to Steam", body: "The Vapor look of SteamOS for the desktop, with its panel, launcher icon and wallpaper.", changes: ["cachyos-vapor global theme", "Add to Steam in right-click menus", "Nested Desktop, Steam keyboard window rule"] },