mirror of
https://github.com/theupriser/steamify-cachyos.git
synced 2026-10-03 17:41:58 +02:00
fix: Add single user no password option with SDDM, fetch newest Vapor presets
- One wizard question: "single user, no password, like SteamOS" switches to SDDM (autologin via CachyOS's own steam-set-session, no workarounds) and removes lock screen, user switching and log out (launcher shows only Sleep/Restart/Shut Down; Meta+L and Ctrl+Alt+Del unbound). Declining keeps the current login manager and KDE's defaults - Look up the newest steamdeck-kde-presets from Valve's release repos and verify its SHA-256; take over the new SteamOS 3.9 defaults - Restart plasmashell through systemd so the desktop keeps the session's dark theme; drop the bundled icon in favour of Valve's and Steam's - README and AGENTS.md updated
This commit is contained in:
1 parent
4ad6c2c04e
commit
a0bc385765
8 files changed
+290
-45
No files matched your search
@@ -41,6 +41,19 @@ gamescope and the Plasma desktop. Primary target: the Valve Steam Machine
|
|||||||
|
|
||||||
## Non-obvious behaviour to preserve
|
## Non-obvious behaviour to preserve
|
||||||
|
|
||||||
|
- One wizard question in `choose_setup_mode` sets `$SINGLE_USER` and
|
||||||
|
`$LOGIN_MANAGER`. "Single user, no password" = SteamOS: SDDM plus no lock
|
||||||
|
screen, user switching or log out (`setup_single_user`; the launcher's
|
||||||
|
Session dropdown is hidden via kickoff `primaryActions=3` because
|
||||||
|
restricting `action/logout` also hides Restart/Shut Down). Otherwise the
|
||||||
|
current login manager stays. Two login-manager paths:
|
||||||
|
**sddm** (like SteamOS: `steam-set-session` writes
|
||||||
|
`/etc/sddm.conf.d/zz-steamos-autologin.conf`, which SDDM honours; we add
|
||||||
|
`User=`/`Relogin=` in `10-gamescope-autologin.conf`, and `/etc/sddm.conf`
|
||||||
|
must not contain `[Autologin]` since it's read last) and **plasmalogin**
|
||||||
|
(needs the sync bridge and the shortcut's sudoers rule). Both must keep
|
||||||
|
working.
|
||||||
|
|
||||||
- `steam-set-session` only writes `/etc/plasmalogin.conf.d/zz-steamos-autologin.conf`;
|
- `steam-set-session` only writes `/etc/plasmalogin.conf.d/zz-steamos-autologin.conf`;
|
||||||
the base `/etc/plasmalogin.conf` wins, hence the sync bridge. The sync
|
the base `/etc/plasmalogin.conf` wins, hence the sync bridge. The sync
|
||||||
service needs `StartLimitIntervalSec=0`, or bursts of session switches
|
service needs `StartLimitIntervalSec=0`, or bursts of session switches
|
||||||
@@ -83,7 +96,8 @@ Behaviour is best verified in a CachyOS VM (QEMU/KVM, KDE Plasma install,
|
|||||||
runs. Notes from doing this:
|
runs. Notes from doing this:
|
||||||
|
|
||||||
- Run the script non-interactively by piping answers, e.g.
|
- Run the script non-interactively by piping answers, e.g.
|
||||||
`printf "\ny\nn\n" | ./setup-gamescope-boot.sh` (user, theme, reboot).
|
`printf "\ny\nn\nn\n" | ./setup-gamescope-boot.sh` (user, single user,
|
||||||
|
theme, reboot).
|
||||||
The prompt order depends on what's already installed.
|
The prompt order depends on what's already installed.
|
||||||
- Over SSH, export the session environment before running it so the live
|
- Over SSH, export the session environment before running it so the live
|
||||||
Plasma steps work:
|
Plasma steps work:
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ script fixes that and sets everything up for you.
|
|||||||
|
|
||||||
## What you get
|
## What you get
|
||||||
|
|
||||||
- **Boots into gaming mode** automatically, without a login screen.
|
- **Boots into gaming mode** automatically - you never see a login screen,
|
||||||
|
just like SteamOS.
|
||||||
- **Switch to Desktop** from Steam's power menu works, and so does going
|
- **Switch to Desktop** from Steam's power menu works, and so does going
|
||||||
back: use the **Return to Gaming Mode** icon on the desktop, or just log
|
back: use the **Return to Gaming Mode** icon on the desktop, or just log
|
||||||
out.
|
out.
|
||||||
@@ -37,8 +38,19 @@ cd <this-repo>
|
|||||||
```
|
```
|
||||||
|
|
||||||
Run it as yourself, not as root. It asks for your password once, then asks a
|
Run it as yourself, not as root. It asks for your password once, then asks a
|
||||||
few yes/no questions (whether to install missing packages, the SteamOS look,
|
few yes/no questions:
|
||||||
and the LED driver on a Steam Machine). At the end it offers to restart.
|
|
||||||
|
- **Single user, no password, like SteamOS?** Recommended for a console.
|
||||||
|
You never see a login or lock screen, and there's no user switching or
|
||||||
|
logging out - typing a password with a controller is no fun. This
|
||||||
|
switches to SDDM, the login manager SteamOS uses. Say no to keep
|
||||||
|
CachyOS's default login manager and KDE's normal lock screen; gaming mode
|
||||||
|
still starts automatically.
|
||||||
|
- whether to install missing packages;
|
||||||
|
- the LED driver (Steam Machine only) and the SteamOS look.
|
||||||
|
|
||||||
|
At the end it offers to restart. The switch to SDDM takes effect from that
|
||||||
|
restart.
|
||||||
|
|
||||||
Keep the whole folder: the script needs the files in `lib/` next to it.
|
Keep the whole folder: the script needs the files in `lib/` next to it.
|
||||||
|
|
||||||
@@ -49,7 +61,7 @@ It's safe to run again later, for example after a CachyOS update.
|
|||||||
- **To the desktop:** in gaming mode, open the Steam menu and choose
|
- **To the desktop:** in gaming mode, open the Steam menu and choose
|
||||||
**Power > Switch to Desktop**.
|
**Power > Switch to Desktop**.
|
||||||
- **Back to gaming mode:** double-click **Return to Gaming Mode** on the
|
- **Back to gaming mode:** double-click **Return to Gaming Mode** on the
|
||||||
desktop, or log out.
|
desktop (or log out, if you didn't choose single user).
|
||||||
- After a restart you always start in gaming mode.
|
- After a restart you always start in gaming mode.
|
||||||
|
|
||||||
Prefer to decide yourself where your PC starts? Run one of these in Konsole:
|
Prefer to decide yourself where your PC starts? Run one of these in Konsole:
|
||||||
@@ -65,7 +77,7 @@ steamos-session-select oneshot # always start in gaming mode (default)
|
|||||||
**Ctrl+Alt+F3**, log in with your username and password, and run:
|
**Ctrl+Alt+F3**, log in with your username and password, and run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
steamos-session-select plasma && sudo systemctl restart plasmalogin
|
sudo /usr/lib/steamos/steam-set-session plasma.desktop && sudo systemctl restart display-manager
|
||||||
```
|
```
|
||||||
|
|
||||||
That takes you back to the desktop.
|
That takes you back to the desktop.
|
||||||
@@ -84,7 +96,34 @@ To remove everything the script set up, see
|
|||||||
|
|
||||||
## Technical details
|
## Technical details
|
||||||
|
|
||||||
### Why this is needed
|
### Single user: SDDM, no locking
|
||||||
|
|
||||||
|
The wizard's first question. Answering yes switches to **SDDM** and turns
|
||||||
|
off everything that asks for a password or another user, per user and
|
||||||
|
without touching system files: `action/lock_screen`, `switch_user` and
|
||||||
|
`start_new_session` restrictions in `kdeglobals`, no automatic locking
|
||||||
|
(`kscreenlockerrc`), Meta+L and Ctrl+Alt+Del unbound, and the launcher shows
|
||||||
|
only Sleep / Restart / Shut Down (kickoff `primaryActions=3`), which hides
|
||||||
|
the Session dropdown with Log Out. (Restricting `action/logout` would also
|
||||||
|
hide Restart and Shut Down.) Answering no restores KDE's defaults and keeps
|
||||||
|
the current login manager.
|
||||||
|
|
||||||
|
**SDDM** is what SteamOS uses, and CachyOS's
|
||||||
|
`steam-set-session` supports it directly: it writes
|
||||||
|
`/etc/sddm.conf.d/zz-steamos-autologin.conf`, which SDDM honours. The script
|
||||||
|
installs and enables `sddm` (disabling the current display manager, active
|
||||||
|
from the next boot), writes `User=`, `Session=` and `Relogin=true` to
|
||||||
|
`/etc/sddm.conf.d/10-gamescope-autologin.conf`, and removes any
|
||||||
|
`[Autologin]` from `/etc/sddm.conf` (read last, so it would override both).
|
||||||
|
No sync bridge or sudoers rule is needed; the shortcut just runs
|
||||||
|
`steamos-session-select gamescope`, which logs out, and `Relogin=true`
|
||||||
|
logs straight back in to gamescope. Switching an existing
|
||||||
|
plasma-login-manager setup to SDDM removes the sync bridge.
|
||||||
|
|
||||||
|
Keeping **plasma-login-manager** (CachyOS's default since March 2026) needs
|
||||||
|
the workarounds below.
|
||||||
|
|
||||||
|
### Why this is needed (plasma-login-manager)
|
||||||
|
|
||||||
CachyOS's `gamescope-session-cachyos` package ships `steamos-session-select`,
|
CachyOS's `gamescope-session-cachyos` package ships `steamos-session-select`,
|
||||||
which is meant to work exactly like it does on real SteamOS. Since the March
|
which is meant to work exactly like it does on real SteamOS. Since the March
|
||||||
@@ -117,15 +156,16 @@ tools write to the conf.d fragment into the base config.
|
|||||||
|
|
||||||
In order:
|
In order:
|
||||||
|
|
||||||
1. Checks the display manager (warns if it isn't `plasma-login-manager`) and
|
1. Checks that it runs as the user that should autologin, and asks whether
|
||||||
that it runs as the user that should autologin.
|
to switch to SDDM (see above).
|
||||||
2. Installs missing packages: `gamescope-session-cachyos`, `steam`,
|
2. Installs missing packages: `gamescope-session-cachyos`, `steam`,
|
||||||
`mangohud`, `xterm`, `ttf-liberation`, `wqy-zenhei`, `plasma-keyboard`.
|
`mangohud`, `xterm`, `ttf-liberation`, `wqy-zenhei`, `plasma-keyboard`.
|
||||||
3. Creates `/etc/plasmalogin.conf.d`, backs up and rewrites the
|
3. *SDDM:* installs/enables SDDM and writes its autologin config.
|
||||||
|
*plasma-login-manager:* creates `/etc/plasmalogin.conf.d`, backs up and rewrites the
|
||||||
`[Autologin]` section of `/etc/plasmalogin.conf`, and removes stray
|
`[Autologin]` section of `/etc/plasmalogin.conf`, and removes stray
|
||||||
`zzz-steamos-autologin*.conf` files from manual troubleshooting (never
|
`zzz-steamos-autologin*.conf` files from manual troubleshooting (never
|
||||||
`zz-steamos-autologin.conf`, which CachyOS's tools own).
|
`zz-steamos-autologin.conf`, which CachyOS's tools own).
|
||||||
4. Installs `/usr/local/bin/sync-steamos-session.sh` plus
|
4. *plasma-login-manager only:* installs `/usr/local/bin/sync-steamos-session.sh` plus
|
||||||
`sync-steamos-session.path`/`.service`, which keep the base config in sync
|
`sync-steamos-session.path`/`.service`, which keep the base config in sync
|
||||||
with session switches.
|
with session switches.
|
||||||
5. Sets up Steam for the desktop: `STEAM_GAMEPADUI_ARGS="-gamepadui -steamos3"`
|
5. Sets up Steam for the desktop: `STEAM_GAMEPADUI_ARGS="-gamepadui -steamos3"`
|
||||||
@@ -134,9 +174,9 @@ In order:
|
|||||||
that starts Steam silently in Plasma only.
|
that starts Steam silently in Plasma only.
|
||||||
6. *(Steam Machine, optional)* the LED driver - see below.
|
6. *(Steam Machine, optional)* the LED driver - see below.
|
||||||
7. *(Optional)* the SteamOS desktop look - see below.
|
7. *(Optional)* the SteamOS desktop look - see below.
|
||||||
8. Creates the **Return to Gaming Mode** shortcut, with a narrow sudoers rule
|
8. Creates the **Return to Gaming Mode** shortcut. On plasma-login-manager it
|
||||||
(`/etc/sudoers.d/gamescope-session-switch`) so it can restart the login
|
also adds a narrow sudoers rule (`/etc/sudoers.d/gamescope-session-switch`)
|
||||||
manager without a password prompt.
|
so it can restart the login manager without a password prompt.
|
||||||
|
|
||||||
Re-running doesn't duplicate any settings. Every system file it modifies is
|
Re-running doesn't duplicate any settings. Every system file it modifies is
|
||||||
backed up once, next to the original, with a `.bak-gamescope-wizard` suffix.
|
backed up once, next to the original, with a `.bak-gamescope-wizard` suffix.
|
||||||
@@ -216,7 +256,11 @@ immediately, which can turn into a loop - hence the Ctrl+Alt+F3 escape above.
|
|||||||
### Removing everything
|
### Removing everything
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# restore the original login config
|
# SDDM: go back to plasma-login-manager
|
||||||
|
sudo rm /etc/sddm.conf.d/10-gamescope-autologin.conf
|
||||||
|
sudo systemctl disable sddm && sudo systemctl enable plasmalogin
|
||||||
|
|
||||||
|
# plasma-login-manager: restore the original login config
|
||||||
sudo cp /etc/plasmalogin.conf.bak-gamescope-wizard /etc/plasmalogin.conf
|
sudo cp /etc/plasmalogin.conf.bak-gamescope-wizard /etc/plasmalogin.conf
|
||||||
|
|
||||||
# session sync watcher
|
# session sync watcher
|
||||||
@@ -248,7 +292,7 @@ sudo pacman -R leds-valve-dkms-git
|
|||||||
| `setup-gamescope-boot.sh` | Entry point: user and sudo checks, step order, summary, reboot |
|
| `setup-gamescope-boot.sh` | Entry point: user and sudo checks, step order, summary, reboot |
|
||||||
| `lib/common.sh` | Output helpers, yes/no prompts, backups |
|
| `lib/common.sh` | Output helpers, yes/no prompts, backups |
|
||||||
| `lib/packages.sh` | Required packages, AUR helper (yay/paru) |
|
| `lib/packages.sh` | Required packages, AUR helper (yay/paru) |
|
||||||
| `lib/login-manager.sh` | plasmalogin autologin, session sync bridge and its systemd units |
|
| `lib/login-manager.sh` | SDDM or plasmalogin choice and autologin, session sync bridge |
|
||||||
| `lib/steam-desktop.sh` | Steam in the Plasma session: gamepad UI flags, virtual keyboard, autostart |
|
| `lib/steam-desktop.sh` | Steam in the Plasma session: gamepad UI flags, virtual keyboard, autostart |
|
||||||
| `lib/led-driver.sh` | Fremont detection, kernel headers, LED driver, OpenRGB |
|
| `lib/led-driver.sh` | Fremont detection, kernel headers, LED driver, OpenRGB |
|
||||||
| `lib/vapor-theme.sh` | Vapor theme, Valve's SteamOS defaults, panel, dark mode |
|
| `lib/vapor-theme.sh` | Vapor theme, Valve's SteamOS defaults, panel, dark mode |
|
||||||
@@ -263,9 +307,7 @@ Notes for contributors and AI coding agents are in [`AGENTS.md`](AGENTS.md).
|
|||||||
become unnecessary - please open an issue or PR if you notice that.
|
become unnecessary - please open an issue or PR if you notice that.
|
||||||
- Tested on a Valve Steam Machine running CachyOS Desktop edition. It should
|
- Tested on a Valve Steam Machine running CachyOS Desktop edition. It should
|
||||||
work on any CachyOS desktop install using `plasma-login-manager`, but
|
work on any CachyOS desktop install using `plasma-login-manager`, but
|
||||||
hasn't been tested on Steam Deck/Legion Go hardware, which typically use
|
hasn't been tested on Steam Deck/Legion Go hardware.
|
||||||
SDDM. With another display manager the script warns and asks before
|
|
||||||
continuing.
|
|
||||||
|
|
||||||
### Related upstream reports
|
### Related upstream reports
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,18 @@ require_root_helper() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plasma_applets() {
|
||||||
|
# Print "containment:applet" for every applet of plugin $1 in the
|
||||||
|
# user's Plasma layout, for kwriteconfig6 --group paths.
|
||||||
|
local conf="$HOME/.config/plasma-org.kde.plasma.desktop-appletsrc"
|
||||||
|
[[ -f "$conf" ]] || return 0
|
||||||
|
awk -v plugin="$1" '
|
||||||
|
/^\[Containments\]\[[0-9]+\]\[Applets\]\[[0-9]+\]$/ { split($0, p, /[][]+/); sect = p[3] ":" p[5] }
|
||||||
|
/^\[/ && !/\]\[Applets\]\[[0-9]+\]$/ { sect = "" }
|
||||||
|
$0 == "plugin=" plugin && sect != "" { print sect }
|
||||||
|
' "$conf"
|
||||||
|
}
|
||||||
|
|
||||||
backup_file() {
|
backup_file() {
|
||||||
local f="$1"
|
local f="$1"
|
||||||
if [[ -f "$f" && ! -f "${f}.bak-gamescope-wizard" ]]; then
|
if [[ -f "$f" && ! -f "${f}.bak-gamescope-wizard" ]]; then
|
||||||
|
|||||||
+12
-4
@@ -17,9 +17,14 @@ create_desktop_shortcut() {
|
|||||||
|
|
||||||
mkdir -p "$desktop_dir"
|
mkdir -p "$desktop_dir"
|
||||||
|
|
||||||
# Let the shortcut restart the login manager without a password prompt
|
# On SDDM, steamos-session-select logging out is enough: Relogin=true
|
||||||
# (it runs with Terminal=false, so sudo can't ask). Scoped to exactly
|
# logs straight back in to the newly selected session, like SteamOS.
|
||||||
# the two commands the shortcut needs, for this user only.
|
# plasma-login-manager needs the sync bridge run and a restart, which
|
||||||
|
# the shortcut can't sudo for interactively (Terminal=false), so it gets
|
||||||
|
# a password-less rule scoped to exactly those two commands.
|
||||||
|
local exec_line="steamos-session-select gamescope"
|
||||||
|
if [[ "$LOGIN_MANAGER" == "plasmalogin" ]]; then
|
||||||
|
exec_line="sh -c 'steamos-session-select gamescope && sudo -n /usr/bin/systemctl start sync-steamos-session.service && sudo -n /usr/bin/systemctl restart plasmalogin'"
|
||||||
local sudoers_tmp
|
local sudoers_tmp
|
||||||
sudoers_tmp="$(mktemp)"
|
sudoers_tmp="$(mktemp)"
|
||||||
cat > "$sudoers_tmp" << EOF
|
cat > "$sudoers_tmp" << EOF
|
||||||
@@ -32,6 +37,9 @@ EOF
|
|||||||
warn "Generated sudoers rule failed validation; the shortcut will not be able to restart plasmalogin."
|
warn "Generated sudoers rule failed validation; the shortcut will not be able to restart plasmalogin."
|
||||||
fi
|
fi
|
||||||
rm -f "$sudoers_tmp"
|
rm -f "$sudoers_tmp"
|
||||||
|
else
|
||||||
|
sudo rm -f /etc/sudoers.d/gamescope-session-switch
|
||||||
|
fi
|
||||||
|
|
||||||
# SteamOS itself uses Valve's "gaming-return" icon (Steam logo with a
|
# SteamOS itself uses Valve's "gaming-return" icon (Steam logo with a
|
||||||
# return arrow; the Deck-style arrow is only used on Steam Deck
|
# return arrow; the Deck-style arrow is only used on Steam Deck
|
||||||
@@ -48,7 +56,7 @@ EOF
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Name=Return to Gaming Mode
|
Name=Return to Gaming Mode
|
||||||
Comment=Switch session back to Gamescope
|
Comment=Switch session back to Gamescope
|
||||||
Exec=sh -c 'steamos-session-select gamescope && sudo -n /usr/bin/systemctl start sync-steamos-session.service && sudo -n /usr/bin/systemctl restart plasmalogin'
|
Exec=$exec_line
|
||||||
Icon=$shortcut_icon
|
Icon=$shortcut_icon
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
|
|||||||
+102
-10
@@ -4,21 +4,113 @@
|
|||||||
|
|
||||||
BASE_CONF="/etc/plasmalogin.conf"
|
BASE_CONF="/etc/plasmalogin.conf"
|
||||||
|
|
||||||
check_display_manager() {
|
choose_setup_mode() {
|
||||||
# Step 1: warn when the login manager is not plasma-login-manager.
|
# Step 1: one question decides both the login manager and locking.
|
||||||
local DM
|
# "Single user, no password" is SteamOS: SDDM (which CachyOS's session
|
||||||
DM="$(systemctl show -p Id --value display-manager 2>/dev/null | sed 's/\.service$//')"
|
# tools support directly, no workarounds) plus no lock screen, user
|
||||||
info "Detected display manager: ${DM:-none}"
|
# switching or log out. Otherwise keep the current login manager
|
||||||
|
# (CachyOS's default plasma-login-manager gets the sync bridge below)
|
||||||
|
# and KDE's normal locking. Sets SINGLE_USER and LOGIN_MANAGER.
|
||||||
|
local current
|
||||||
|
current="$(systemctl show -p Id --value display-manager 2>/dev/null | sed 's/\.service$//')"
|
||||||
|
info "Detected display manager: ${current:-none}"
|
||||||
|
|
||||||
if [[ "$DM" != "plasmalogin" ]]; then
|
echo "SteamOS is a single-user console without passwords: no login screen, no"
|
||||||
warn "This wizard was built and tested against plasma-login-manager (plasmalogin)."
|
echo "lock screen, no user switching or logging out - typing a password with a"
|
||||||
warn "Detected display manager is '${DM:-unknown}'. SDDM setups don't need"
|
echo "controller is no fun. It uses the SDDM login manager for that."
|
||||||
warn "most of these workarounds (SDDM's own Autologin works out of the box);"
|
if ask_yn "Single user, no password, like SteamOS? (switches to SDDM)" y; then
|
||||||
warn "this script will still try, but review the output carefully."
|
SINGLE_USER=true
|
||||||
|
LOGIN_MANAGER="sddm"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
SINGLE_USER=false
|
||||||
|
if [[ "$current" == "sddm" ]]; then
|
||||||
|
LOGIN_MANAGER="sddm"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
LOGIN_MANAGER="plasmalogin"
|
||||||
|
if [[ "$current" != "plasmalogin" ]]; then
|
||||||
|
warn "The workarounds are built for plasma-login-manager, but '${current:-unknown}' is active."
|
||||||
ask_yn "Continue anyway?" n || exit 0
|
ask_yn "Continue anyway?" n || exit 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setup_login_manager() {
|
||||||
|
# Steps 3-8 for whichever login manager was chosen in step 1.
|
||||||
|
case "$LOGIN_MANAGER" in
|
||||||
|
sddm)
|
||||||
|
switch_to_sddm || exit 1
|
||||||
|
configure_sddm_autologin
|
||||||
|
remove_session_sync
|
||||||
|
;;
|
||||||
|
plasmalogin)
|
||||||
|
configure_autologin
|
||||||
|
install_session_sync
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_to_sddm() {
|
||||||
|
# Takes effect at the next boot; the running session is left alone.
|
||||||
|
info "Installing and enabling SDDM..."
|
||||||
|
sudo pacman -S --needed --noconfirm sddm || { err "Installing sddm failed."; return 1; }
|
||||||
|
local current
|
||||||
|
current="$(systemctl show -p Id --value display-manager 2>/dev/null)"
|
||||||
|
if [[ -n "$current" && "$current" != "sddm.service" ]]; then
|
||||||
|
sudo systemctl disable "$current"
|
||||||
|
fi
|
||||||
|
sudo systemctl enable -f sddm.service || { err "Enabling sddm failed."; return 1; }
|
||||||
|
ok "SDDM is the login manager from the next boot on."
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_sddm_autologin() {
|
||||||
|
# User= and Relogin= live in our own fragment; steam-set-session keeps
|
||||||
|
# Session= up to date in zz-steamos-autologin.conf, which sorts later
|
||||||
|
# and so wins. /etc/sddm.conf is read last, so any [Autologin] there
|
||||||
|
# would override both and is removed.
|
||||||
|
local conf="/etc/sddm.conf.d/10-gamescope-autologin.conf"
|
||||||
|
info "Configuring SDDM autologin for $TARGET_USER into gamescope (Relogin=true)"
|
||||||
|
sudo mkdir -p /etc/sddm.conf.d
|
||||||
|
sudo tee "$conf" > /dev/null << EOF
|
||||||
|
[Autologin]
|
||||||
|
User=$TARGET_USER
|
||||||
|
Session=gamescope-session.desktop
|
||||||
|
Relogin=true
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [[ -f /etc/sddm.conf ]] && grep -q '^\[Autologin\]' /etc/sddm.conf; then
|
||||||
|
backup_file /etc/sddm.conf
|
||||||
|
sudo awk '
|
||||||
|
/^\[Autologin\]/ { skip=1; next }
|
||||||
|
/^\[/ { skip=0 }
|
||||||
|
!skip { print }
|
||||||
|
' /etc/sddm.conf | sudo tee /etc/sddm.conf.tmp > /dev/null &&
|
||||||
|
sudo mv /etc/sddm.conf.tmp /etc/sddm.conf
|
||||||
|
info "Removed [Autologin] from /etc/sddm.conf (backup kept)."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start in gamescope, through CachyOS's own tool so its file is current.
|
||||||
|
sudo /usr/lib/steamos/steam-set-session gamescope-session.desktop
|
||||||
|
|
||||||
|
ok "SDDM autologin configured:"
|
||||||
|
cat "$conf"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
remove_session_sync() {
|
||||||
|
# The plasmalogin sync bridge from an earlier run isn't needed on SDDM.
|
||||||
|
if [[ -f /etc/systemd/system/sync-steamos-session.path ]]; then
|
||||||
|
info "Removing the plasma-login-manager sync bridge (not needed with SDDM)..."
|
||||||
|
sudo systemctl disable --now sync-steamos-session.path 2>/dev/null
|
||||||
|
sudo rm -f /etc/systemd/system/sync-steamos-session.path \
|
||||||
|
/etc/systemd/system/sync-steamos-session.service \
|
||||||
|
/usr/local/bin/sync-steamos-session.sh
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
configure_autologin() {
|
configure_autologin() {
|
||||||
# Steps 3-5: plasmalogin.conf.d, the base [Autologin] section, stray fragments.
|
# Steps 3-5: plasmalogin.conf.d, the base [Autologin] section, stray fragments.
|
||||||
# 3. Ensure plasmalogin.conf.d exists (fixes Switch-to-Desktop crash)
|
# 3. Ensure plasmalogin.conf.d exists (fixes Switch-to-Desktop crash)
|
||||||
|
|||||||
+70
-1
@@ -1,5 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Steam in the Plasma desktop session: gamepad UI args, virtual keyboard, autostart.
|
# Steam in the Plasma desktop session: gamepad UI args, virtual keyboard,
|
||||||
|
# autostart, and no screen locking (like SteamOS).
|
||||||
# Sourced by setup-gamescope-boot.sh; not meant to be run on its own.
|
# Sourced by setup-gamescope-boot.sh; not meant to be run on its own.
|
||||||
|
|
||||||
setup_steam_desktop() {
|
setup_steam_desktop() {
|
||||||
@@ -52,3 +53,71 @@ EOF
|
|||||||
|
|
||||||
ok "Steam UI parameters and keyboard autostart deployed successfully."
|
ok "Steam UI parameters and keyboard autostart deployed successfully."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setup_single_user() {
|
||||||
|
# With SINGLE_USER (chosen in step 1), like SteamOS: one user and no
|
||||||
|
# password prompts, since typing a password with a controller is
|
||||||
|
# miserable. Hides Lock / Switch User / Log Out
|
||||||
|
# everywhere (launcher, Meta+L, Ctrl+Alt+Del) and never locks on idle or
|
||||||
|
# resume; "Return to Gaming Mode" is the way out of the desktop. Declining
|
||||||
|
# restores KDE's defaults.
|
||||||
|
local action allow=true
|
||||||
|
[[ "$SINGLE_USER" == true ]] && allow=false
|
||||||
|
for action in lock_screen switch_user start_new_session; do
|
||||||
|
kwriteconfig6 --file kdeglobals --group "KDE Action Restrictions" --key "action/$action" "$allow"
|
||||||
|
done
|
||||||
|
if [[ "$allow" == false ]]; then
|
||||||
|
kwriteconfig6 --file kscreenlockerrc --group Daemon --key Autolock false
|
||||||
|
kwriteconfig6 --file kscreenlockerrc --group Daemon --key LockOnResume false
|
||||||
|
kwriteconfig6 --file kscreenlockerrc --group Daemon --key Timeout 0
|
||||||
|
# The action restriction hides Lock in menus but not the Meta+L
|
||||||
|
# shortcut; unbind it (format: current,default,description).
|
||||||
|
kwriteconfig6 --file kglobalshortcutsrc --group ksmserver --key "Lock Session" \
|
||||||
|
$'none,Screensaver\tMeta+L,Lock Session'
|
||||||
|
kwriteconfig6 --file kglobalshortcutsrc --group ksmserver --key "Log Out" \
|
||||||
|
'none,Ctrl+Alt+Del,Show Logout Screen'
|
||||||
|
set_launcher_leave_buttons single
|
||||||
|
ok "Screen locking, user switching and logging out disabled."
|
||||||
|
else
|
||||||
|
kwriteconfig6 --file kscreenlockerrc --group Daemon --key Autolock --delete
|
||||||
|
kwriteconfig6 --file kscreenlockerrc --group Daemon --key LockOnResume --delete
|
||||||
|
kwriteconfig6 --file kscreenlockerrc --group Daemon --key Timeout --delete
|
||||||
|
kwriteconfig6 --file kglobalshortcutsrc --group ksmserver --key "Lock Session" \
|
||||||
|
$'Screensaver\tMeta+L,Screensaver\tMeta+L,Lock Session'
|
||||||
|
kwriteconfig6 --file kglobalshortcutsrc --group ksmserver --key "Log Out" \
|
||||||
|
'Ctrl+Alt+Del,Ctrl+Alt+Del,Show Logout Screen'
|
||||||
|
set_launcher_leave_buttons default
|
||||||
|
ok "Keeping KDE's normal screen locking and user switching."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_launcher_leave_buttons() {
|
||||||
|
# "single": only Sleep / Restart / Shut Down buttons in the launcher, no
|
||||||
|
# Session dropdown (that's where Log Out lives). Restricting the
|
||||||
|
# "logout" action instead would also hide Restart and Shut Down.
|
||||||
|
# "default": Plasma's own buttons.
|
||||||
|
local mode="$1" applet
|
||||||
|
for applet in $(plasma_applets org.kde.plasma.kickoff); do
|
||||||
|
local -a grp=(--file plasma-org.kde.plasma.desktop-appletsrc --group Containments
|
||||||
|
--group "${applet%%:*}" --group Applets --group "${applet#*:}"
|
||||||
|
--group Configuration --group General)
|
||||||
|
if [[ "$mode" == single ]]; then
|
||||||
|
kwriteconfig6 "${grp[@]}" --key primaryActions 3
|
||||||
|
kwriteconfig6 "${grp[@]}" --key systemFavorites 'suspend,reboot,shutdown'
|
||||||
|
else
|
||||||
|
kwriteconfig6 "${grp[@]}" --key primaryActions --delete
|
||||||
|
kwriteconfig6 "${grp[@]}" --key systemFavorites --delete
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if pgrep -u "$USER" -x plasmashell >/dev/null; then
|
||||||
|
local js
|
||||||
|
if [[ "$mode" == single ]]; then
|
||||||
|
js="w.writeConfig('primaryActions', 3); w.writeConfig('systemFavorites', 'suspend,reboot,shutdown');"
|
||||||
|
else
|
||||||
|
js="w.writeConfig('primaryActions', 0); w.writeConfig('systemFavorites', 'suspend,hibernate,reboot,shutdown');"
|
||||||
|
fi
|
||||||
|
qdbus6 org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript \
|
||||||
|
"panels().forEach(function (p) { p.widgets('org.kde.plasma.kickoff').forEach(function (w) { w.currentConfigGroup = ['General']; $js w.reloadConfig(); }); })" \
|
||||||
|
>/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
+3
-2
@@ -103,12 +103,13 @@ install_vapor_theme() {
|
|||||||
[[ -d "${tmp_dir}/usr/share/plasma/avatars" ]] && cp -r "${tmp_dir}/usr/share/plasma/avatars/"* ~/.local/share/plasma/avatars/
|
[[ -d "${tmp_dir}/usr/share/plasma/avatars" ]] && cp -r "${tmp_dir}/usr/share/plasma/avatars/"* ~/.local/share/plasma/avatars/
|
||||||
|
|
||||||
# Valve's SteamOS desktop defaults (fonts, Steam keyboard window rule,
|
# Valve's SteamOS desktop defaults (fonts, Steam keyboard window rule,
|
||||||
# no screen locking, no welcome screen, light file indexing, GTK theme).
|
# no welcome screen, light file indexing, GTK theme).
|
||||||
# Left out on purpose: autostart entries (Steam is started by our user
|
# Left out on purpose: autostart entries (Steam is started by our user
|
||||||
# unit), sddm/profile.d, and files hardcoding /home/deck or SteamOS tools.
|
# unit), sddm/profile.d, and files hardcoding /home/deck or SteamOS tools.
|
||||||
info "Applying SteamOS desktop defaults..."
|
info "Applying SteamOS desktop defaults..."
|
||||||
local f
|
local f
|
||||||
for f in kdeglobals kwinrc kwinrulesrc kscreenlockerrc kded5rc baloofilerc kcminputrc; do
|
# kscreenlockerrc is left to the single-user question.
|
||||||
|
for f in kdeglobals kwinrc kwinrulesrc kded5rc baloofilerc kcminputrc; do
|
||||||
[[ -f "${tmp_dir}/etc/xdg/$f" ]] && merge_kde_config "${tmp_dir}/etc/xdg/$f" "$f"
|
[[ -f "${tmp_dir}/etc/xdg/$f" ]] && merge_kde_config "${tmp_dir}/etc/xdg/$f" "$f"
|
||||||
done
|
done
|
||||||
[[ -f "${tmp_dir}/etc/xdg/kded5rc" ]] && merge_kde_config "${tmp_dir}/etc/xdg/kded5rc" kded6rc
|
[[ -f "${tmp_dir}/etc/xdg/kded5rc" ]] && merge_kde_config "${tmp_dir}/etc/xdg/kded5rc" kded6rc
|
||||||
|
|||||||
+16
-9
@@ -80,18 +80,20 @@ fi
|
|||||||
ok "Using user: $TARGET_USER"
|
ok "Using user: $TARGET_USER"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
check_display_manager
|
choose_setup_mode
|
||||||
echo
|
echo
|
||||||
|
|
||||||
install_required_packages
|
install_required_packages
|
||||||
echo
|
echo
|
||||||
|
|
||||||
configure_autologin
|
setup_login_manager
|
||||||
install_session_sync
|
|
||||||
|
|
||||||
setup_steam_desktop
|
setup_steam_desktop
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
setup_single_user
|
||||||
|
echo
|
||||||
|
|
||||||
setup_led_driver
|
setup_led_driver
|
||||||
|
|
||||||
setup_vapor_theme
|
setup_vapor_theme
|
||||||
@@ -105,16 +107,21 @@ echo
|
|||||||
echo -e "${c_bold}Setup complete.${c_reset}"
|
echo -e "${c_bold}Setup complete.${c_reset}"
|
||||||
echo "What this did:"
|
echo "What this did:"
|
||||||
echo " - Installed gamescope-session-cachyos, steam, mangohud and friends (if missing)"
|
echo " - Installed gamescope-session-cachyos, steam, mangohud and friends (if missing)"
|
||||||
echo " - Created /etc/plasmalogin.conf.d (fixes Switch-to-Desktop crash)"
|
if [[ "$LOGIN_MANAGER" == "sddm" ]]; then
|
||||||
echo " - Set $BASE_CONF to autologin '$TARGET_USER' into gamescope, with Relogin=true"
|
echo " - Made SDDM the login manager, autologging '$TARGET_USER' into gamescope"
|
||||||
echo " - Installed a sync bridge + systemd watcher so Steam's Switch-to-Desktop"
|
echo " with Relogin=true, like SteamOS (active from the next boot)"
|
||||||
echo " (and cachyos-gamescope-autologin.service resetting back to gamescope"
|
else
|
||||||
echo " on logout) both actually take effect"
|
echo " - Created /etc/plasmalogin.conf.d (fixes Switch-to-Desktop crash)"
|
||||||
|
echo " - Set $BASE_CONF to autologin '$TARGET_USER' into gamescope, with Relogin=true"
|
||||||
|
echo " - Installed a sync bridge + systemd watcher so Steam's Switch-to-Desktop"
|
||||||
|
echo " (and cachyos-gamescope-autologin.service resetting back to gamescope"
|
||||||
|
echo " on logout) both actually take effect"
|
||||||
|
echo " - Added /etc/sudoers.d/gamescope-session-switch so the desktop shortcut works"
|
||||||
|
fi
|
||||||
echo " - Configured permanent silent Steam autostart so Steam+X works everywhere"
|
echo " - Configured permanent silent Steam autostart so Steam+X works everywhere"
|
||||||
echo " - Injected -steamos3 flag to force original Steam Deck overlay glyphs"
|
echo " - Injected -steamos3 flag to force original Steam Deck overlay glyphs"
|
||||||
echo " - Optionally installed Valve's Vapor (Steam Deck) KDE theme, if you chose to"
|
echo " - Optionally installed Valve's Vapor (Steam Deck) KDE theme, if you chose to"
|
||||||
echo " - On Valve Fremont hardware, optionally set up the leds-valve front LED bar driver"
|
echo " - On Valve Fremont hardware, optionally set up the leds-valve front LED bar driver"
|
||||||
echo " - Added /etc/sudoers.d/gamescope-session-switch so the desktop shortcut works"
|
|
||||||
echo
|
echo
|
||||||
echo "Backups of any files this script modified were saved with a"
|
echo "Backups of any files this script modified were saved with a"
|
||||||
echo ".bak-gamescope-wizard suffix next to the original."
|
echo ".bak-gamescope-wizard suffix next to the original."
|
||||||
|
|||||||
Reference in new issue
Block a user