diff --git a/AGENTS.md b/AGENTS.md index 699aace..250e263 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -311,6 +311,15 @@ gamescope and the Plasma desktop. Primary target: the Valve Steam Machine `steamify.sh --boot gamescope|desktop` on its own (2.7.0, for scripts) only switches `boot` on an installed conversion: `WANTED` is `CURRENT` plus that, so no updates or removals a normal run would pick. +- OS name for Steam (SteamOS conversion, 2.9.0): Steam's System settings + show `lsb_release -d`, so only `DISTRIB_DESCRIPTION` in `/etc/lsb-release` + becomes "CachyOS with Steamify" (a pacman hook, `zz-steamify-os-release`, + sets it again after cachyos-hooks resets it). In `/etc/os-release` only + `VARIANT`/`VARIANT_ID`/`VERSION_ID` (Steam's OS version, refreshed by + `os_version_refresh` after every run that changes something); never `NAME` + or `PRETTY_NAME`: limine-snapper-sync finds the boot entries by the OS name + ("Target OS name ... not found in /boot/limine.conf"). As a guard, + `/etc/default/limine` gets `TARGET_OS_NAME="CachyOS"` when it has none. - `Relogin=true` means a gamescope that fails to start is relaunched in a tight loop; keep that in mind when changing session handling. diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b187f4..a7604a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,8 @@ one per merged pull request. ## 2.9.0 - 2026-09-28 -- **chore: Version 2.9.0** +- `d30d505` **chore: Version 2.9.0** +- **feat: Steam's System settings and About this System like on SteamOS: OS name "CachyOS with Steamify" (lsb-release, kept through CachyOS updates by a pacman hook), Steamify as OS variant and version (os-release VARIANT/VERSION_ID; NAME/PRETTY_NAME stay CachyOS's for limine, TARGET_OS_NAME pinned), "CachyOS Linux with Steamify" in About this System; on a Steam Machine the serial number and Steam's Wi-Fi backend setting (existing installs get it as an update)** ## 2.8.0 - 2026-09-28 diff --git a/lib/backend.sh b/lib/backend.sh index 05be3c1..1e351ec 100644 --- a/lib/backend.sh +++ b/lib/backend.sh @@ -177,6 +177,7 @@ backend_apply() { if backend_run_component "$c" enable; then is_action "$c" || feature_record "$c" enable; else failed+=("$c"); fi done feature_record_unticked + os_version_refresh [[ " ${TO_DISABLE[*]} ${TO_ENABLE[*]} " =~ \ (gaming|single|boot|kpin)\ ]] && RESTART_FOR_LOGIN=true backend_event finished "\"failed\":$(json_list "${failed[@]}"),\"restart\":$(restart_needed && echo true || echo false)" } diff --git a/lib/login-manager.sh b/lib/login-manager.sh index d2c4ea8..3a44e2a 100644 --- a/lib/login-manager.sh +++ b/lib/login-manager.sh @@ -18,6 +18,55 @@ gaming_status() { esac } +# What Steam shows in its System settings: the OS name (`lsb_release -d`: +# DISTRIB_DESCRIPTION in /etc/lsb-release) and Steamify as the OS variant and +# version (os-release's VARIANT/VERSION_ID; its NAME and PRETTY_NAME stay +# CachyOS's, which limine-snapper-sync finds the boot entries by). +# cachyos-hooks resets lsb-release on updates, so our hook sets it again. +OS_NAME_SCRIPT=/usr/local/libexec/steamify-os-release +OS_NAME_HOOK=/etc/pacman.d/hooks/zz-steamify-os-release.hook +# limine's tools take the OS name from TARGET_OS_NAME, else os-release's +# PRETTY_NAME: pinned to CachyOS, the boot entries never depend on os-release. +LIMINE_DEFAULTS=/etc/default/limine + +os_name_enable() { + patch_file steamify-os-release.sh | fill VERSION="$VERSION" | sudo install -Dm755 /dev/stdin "$OS_NAME_SCRIPT" && + patch_file steamify-os-release.hook | fill SCRIPT="$OS_NAME_SCRIPT" | + sudo install -Dm644 /dev/stdin "$OS_NAME_HOOK" && + sudo "$OS_NAME_SCRIPT" || { err "Setting the OS name for Steam failed."; return 1; } + if [[ -f "$LIMINE_DEFAULTS" ]] && ! grep -q '^TARGET_OS_NAME=' "$LIMINE_DEFAULTS"; then + backup_file "$LIMINE_DEFAULTS" + printf '%s\n' 'TARGET_OS_NAME="CachyOS"' | sudo tee -a "$LIMINE_DEFAULTS" > /dev/null + state_set gaming limine_target 1 + fi + return 0 +} + +os_name_disable() { + sudo rm -f "$OS_NAME_HOOK" "$OS_NAME_SCRIPT" + [[ -f /etc/os-release ]] && sudo sed -i -e '/^VARIANT=/d' -e '/^VARIANT_ID=/d' -e '/^VERSION_ID=/d' /etc/os-release + # CachyOS's own values back, the way its hooks write them. + if [[ -x /usr/share/libalpm/scripts/cachyos-branding ]]; then + sudo /usr/share/libalpm/scripts/cachyos-branding os-release + sudo /usr/share/libalpm/scripts/cachyos-branding lsb-release + fi + if [[ -n "$(state_get gaming limine_target)" ]]; then + sudo sed -i '/^TARGET_OS_NAME="CachyOS"$/d' "$LIMINE_DEFAULTS" + state_set gaming limine_target "" + fi + return 0 +} + +os_version_refresh() { + # After every run that changed something (sudo is at hand then): Steam's + # OS version follows Steamify's, not just the one that set it up. Silent: + # the app reads the backend's stdout as JSON. + gaming_status 2>/dev/null || return 0 + grep -qx "VERSION_ID=$VERSION" /etc/os-release 2>/dev/null && return 0 + os_name_enable > /dev/null 2>&1 + return 0 +} + gaming_enable() { # LOGIN_MANAGER (sddm with single user, else plasmalogin) is set by the # menu. Re-running with the other value switches over cleanly. @@ -37,6 +86,10 @@ gaming_enable() { esac create_desktop_shortcut steam_enable + # System Settings' About this System: the name KInfoCenter shows instead + # of os-release's (package-owned, so not edited). + kset gaming kcm-about-distrorc General Name "CachyOS Linux with Steamify" + os_name_enable || return 1 } gaming_disable() { @@ -49,6 +102,8 @@ gaming_disable() { switch_to_plasmalogin remove_desktop_shortcut steam_disable + krevert gaming + os_name_disable ok "The PC boots to the normal login screen again (from the next boot)." } diff --git a/lib/menu.sh b/lib/menu.sh index 9fcebde..4356cee 100644 --- a/lib/menu.sh +++ b/lib/menu.sh @@ -25,8 +25,8 @@ NO_PRESELECT=(boot cec kpin hdmi) # FEATURE_BASELINE. FEATURE_BASELINE=2.1.0 declare -A FEATURE_VERSION=( - [gaming]=2.1.0 [boot]=2.1.0 [theme]=2.1.0 [glyphs]=2.1.0 [single]=2.1.0 - [launcher]=2.1.0 [cec]=2.7.0 [machine]=2.2.0 [poweroff]=2.2.0 [vram]=2.3.0 [notify]=2.5.0 [steamgame]=2.5.1 + [gaming]=2.9.0 [boot]=2.1.0 [theme]=2.1.0 [glyphs]=2.1.0 [single]=2.1.0 + [launcher]=2.1.0 [cec]=2.7.0 [machine]=2.9.0 [poweroff]=2.2.0 [vram]=2.3.0 [notify]=2.5.0 [steamgame]=2.5.1 [kpin]=2.1.0 [hdmi]=2.1.0 ) @@ -465,5 +465,6 @@ apply_changes() { if "${c}_enable"; then is_action "$c" || feature_record "$c" enable; else failed+=("$c"); fi done feature_record_unticked + os_version_refresh FAILED=("${failed[@]}") } diff --git a/lib/steam-machine.sh b/lib/steam-machine.sh index 66fe10d..ceb6ed7 100644 --- a/lib/steam-machine.sh +++ b/lib/steam-machine.sh @@ -378,6 +378,46 @@ machine_status() { pacman -Qi leds-valve-dkms-git >/dev/null 2>&1 && pacman -Qi steamos-manager >/dev/null 2>&1 } +# Steam (steamwebhelper) reads the serial number for its System settings +# straight from DMI, which the kernel makes root-only; SteamOS makes it +# readable. A tmpfiles rule does that at every boot. +SERIAL_TMPFILES=/etc/tmpfiles.d/steamify-serial.conf + +# Steam's Wi-Fi backend switch goes through steamos-manager, which reads and +# writes the backend in this file (SteamOS ships it); without it, it fails +# with "Wi-Fi backend not found in config". wpa_supplicant is what +# NetworkManager uses on CachyOS anyway. Not written when someone set a +# backend themselves. +WIFI_BACKEND_CONF=/etc/NetworkManager/conf.d/99-valve-wifi-backend.conf + +wifi_backend_enable() { + [[ -f "$WIFI_BACKEND_CONF" ]] && return 0 + grep -rqs '^wifi.backend=' /etc/NetworkManager/NetworkManager.conf /etc/NetworkManager/conf.d && return 0 + printf '%s\n' "# Written by Steamify: Steam's Wi-Fi backend setting (steamos-manager)." \ + '[device]' 'wifi.backend=wpa_supplicant' | sudo install -Dm644 /dev/stdin "$WIFI_BACKEND_CONF" || + { err "Writing the Wi-Fi backend setting failed."; return 1; } + state_set machine wifi_backend 1 +} + +wifi_backend_disable() { + [[ -n "$(state_get machine wifi_backend)" ]] || return 0 + sudo rm -f "$WIFI_BACKEND_CONF" + state_clear machine +} + +serial_enable() { + printf '%s\n' "# Written by Steamify: Steam shows the serial number, like on SteamOS." \ + 'z /sys/class/dmi/id/product_serial 0444 - - -' | sudo tee "$SERIAL_TMPFILES" > /dev/null && + sudo systemd-tmpfiles --create "$SERIAL_TMPFILES" || + { err "Making the serial number readable for Steam failed."; return 1; } +} + +serial_disable() { + sudo rm -f "$SERIAL_TMPFILES" + sudo chmod 0400 /sys/class/dmi/id/product_serial 2>/dev/null + return 0 +} + machine_enable() { # The pinned kernel first when it's wanted too, so DKMS builds the LED # driver for it once, instead of for the current kernel and then again. @@ -403,6 +443,8 @@ EOF # for hardware and controller settings; it knows the Steam Machine from its DMI data. info "Installing hardware manager packages (steamos-manager & inputplumber)..." sudo pacman -S --needed --noconfirm steamos-manager inputplumber || { err "Installing hardware manager packages failed."; return 1; } + serial_enable || return 1 + wifi_backend_enable || return 1 sudo systemctl enable --now inputplumber.service sudo systemctl enable --now steamos-manager.service user_systemctl enable steamos-manager.service 2>/dev/null @@ -426,6 +468,8 @@ machine_disable() { sudo systemctl disable --now steamos-manager.service 2>/dev/null sudo systemctl disable --now inputplumber.service 2>/dev/null sudo pacman -Rns --noconfirm steamos-manager inputplumber 2>/dev/null + serial_disable + wifi_backend_disable sudo rm -f "$LED_UDEV_RULE" /etc/modules-load.d/leds-valve.conf sudo udevadm control --reload sudo modprobe -r leds-valve 2>/dev/null diff --git a/patches/README.md b/patches/README.md index ffed613..256f41c 100644 --- a/patches/README.md +++ b/patches/README.md @@ -13,4 +13,5 @@ read and reviewed on their own. `lib/*.sh` reads them with `patch_file | `steamify-fremont-poweroff.dkms.conf`, `steamify-cros-ec-cec.dkms.conf` | `lib/fremont-poweroff.sh`, `lib/cec.sh` | The DKMS modules' `dkms.conf` (`fill NAME=... VERSION=...`) | | `steam-shortcuts.py` | `lib/steam-game.sh` (Add as non-Steam game) | Reads and writes Steam's binary `shortcuts.vdf` (find, add or update, remove) | | `steamify-notifier.py` | `lib/update-notifier.sh` (Update notifications) | The daily check: notification and tray icon when there's a new release | +| `steamify-os-release.sh`, `steamify-os-release.hook` | `lib/login-manager.sh` (SteamOS conversion) | Sets the OS name Steam shows ("CachyOS with Steamify": `DISTRIB_DESCRIPTION` in `/etc/lsb-release`, which `lsb_release -d` gives Steam; never `/etc/os-release`, whose `PRETTY_NAME` limine-snapper-sync needs); the pacman hook runs it again after cachyos-hooks resets it (`fill SCRIPT=...`) | | `cros-ec-cec-single-port.patch` | `lib/cec.sh` (HDMI-CEC) | Makes Valve's Steam Machine CEC driver find amdgpu's HDMI port | diff --git a/patches/steamify-os-release.hook b/patches/steamify-os-release.hook new file mode 100644 index 0000000..c4ce503 --- /dev/null +++ b/patches/steamify-os-release.hook @@ -0,0 +1,15 @@ +# Installed by Steamify CachyOS (SteamOS conversion): runs after +# cachyos-hooks' lsb-release/cachyos-branding hooks (hooks run in file name +# order). +[Trigger] +Operation = Install +Operation = Upgrade +Type = Package +Target = filesystem +Target = lsb-release +Target = cachyos-hooks + +[Action] +Description = Steamify: the OS name Steam shows (CachyOS with Steamify) +When = PostTransaction +Exec = @SCRIPT@ diff --git a/patches/steamify-os-release.sh b/patches/steamify-os-release.sh new file mode 100644 index 0000000..07d4def --- /dev/null +++ b/patches/steamify-os-release.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# Installed by Steamify CachyOS (SteamOS conversion): what Steam shows in its +# System settings. The OS name is `lsb_release -d` (DISTRIB_DESCRIPTION in +# /etc/lsb-release); the version comes from /etc/os-release's VARIANT and +# VERSION_ID. CachyOS's hooks reset lsb-release on updates of lsb-release and +# cachyos-hooks; the zz-steamify-os-release hook runs this after them. +# os-release's NAME and PRETTY_NAME stay CachyOS's: limine-snapper-sync finds +# the boot entries by the OS name. +sed -i 's|^DISTRIB_DESCRIPTION=.*$|DISTRIB_DESCRIPTION="CachyOS with Steamify"|' /etc/lsb-release +sed -i -e '/^VARIANT=/d' -e '/^VARIANT_ID=/d' -e '/^VERSION_ID=/d' /etc/os-release +printf '%s\n' 'VARIANT="Steamify"' 'VARIANT_ID=steamify' 'VERSION_ID=@VERSION@' >> /etc/os-release