mirror of
https://github.com/theupriser/steamify-cachyos.git
synced 2026-10-14 15:44:47 +02:00
Preferred desktop for Switch to Desktop (kde/gnome/last), session tools for every login manager when GNOME is installed, GNOME theme texts in the app
This commit is contained in:
1 parent
09ef0b1c71
commit
68342e7a24
5 files changed
+75
-8
No files matched your search
+20
-2
@@ -31,13 +31,31 @@ desktop_session_file() {
|
||||
}
|
||||
|
||||
choose_login_manager() {
|
||||
# LOGIN_MANAGER for gaming_enable: gdm on GNOME, else sddm with single
|
||||
# user mode and plasmalogin without.
|
||||
# LOGIN_MANAGER for gaming_enable. With KDE and GNOME both installed the active login
|
||||
# manager stays (switching it would be a surprise); otherwise gdm on GNOME, sddm with
|
||||
# single user mode and plasmalogin without.
|
||||
local current
|
||||
current="$(current_display_manager)"
|
||||
if desktop_installed gnome && desktop_installed kde; then
|
||||
case "$current" in gdm|sddm|plasmalogin) LOGIN_MANAGER="$current"; return ;; esac
|
||||
fi
|
||||
if [[ "$(desktop_kind)" == gnome ]]; then LOGIN_MANAGER=gdm
|
||||
elif [[ "${WANTED[single]:-0}" == 1 ]]; then LOGIN_MANAGER=sddm
|
||||
else LOGIN_MANAGER=plasmalogin; fi
|
||||
}
|
||||
|
||||
# Which desktop "Switch to Desktop" (and booting into the desktop) goes to when both are
|
||||
# installed: kde, gnome, or last (the one you left for gamescope). Read by the session tool.
|
||||
DESKTOP_PREF_FILE=/etc/steamify/desktop
|
||||
|
||||
desktop_pref_get() {
|
||||
cat "$DESKTOP_PREF_FILE" 2>/dev/null || echo last
|
||||
}
|
||||
|
||||
desktop_pref_set() {
|
||||
printf '%s\n' "$1" | sudo install -Dm644 /dev/stdin "$DESKTOP_PREF_FILE"
|
||||
}
|
||||
|
||||
desktop_installed() {
|
||||
# desktop_installed kde|gnome: its session is installed (both can be: the
|
||||
# menu then offers the theme of each).
|
||||
|
||||
@@ -1,26 +1,28 @@
|
||||
#!/bin/bash
|
||||
# steamos-session-select for GDM (Steamify prototype): CachyOS's own ends the
|
||||
# session with a KDE-only D-Bus call. GDM logs in by itself only when it
|
||||
# steamos-session-select for GNOME (Steamify prototype): CachyOS's own ends the
|
||||
# session with a KDE-only D-Bus call and goes to Plasma only. GDM logs in by itself only when it
|
||||
# starts, so after the new session is set the user is ended and GDM restarted
|
||||
# (patches/steamify-gdm-relogin.sh): it then logs the autologin user straight into it.
|
||||
set -e
|
||||
|
||||
DM_ID="$(systemctl show -p Id --value display-manager)"
|
||||
DM_ID="${DM_ID%.service}"
|
||||
DESKTOP_SESSION=@DESKTOP_SESSION@
|
||||
|
||||
relogin() {
|
||||
# Out of the running session into the one that was set.
|
||||
case "$DM_ID" in
|
||||
gdm) sudo -n /usr/local/libexec/steamify-gdm-relogin ;;
|
||||
*) qdbus6 org.kde.Shutdown /Shutdown org.kde.Shutdown.logout ;;
|
||||
*)
|
||||
# sddm and plasma-login-manager log in again by themselves (Relogin=true): just end the session.
|
||||
if [[ "${XDG_CURRENT_DESKTOP:-}" == *GNOME* ]]; then gnome-session-quit --no-prompt --logout
|
||||
else qdbus6 org.kde.Shutdown /Shutdown org.kde.Shutdown.logout; fi ;;
|
||||
esac
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
persistent)
|
||||
systemctl --user mask cachyos-gamescope-autologin.service
|
||||
pkexec /usr/lib/steamos/steam-set-session "$DESKTOP_SESSION" ;;
|
||||
pkexec /usr/lib/steamos/steam-set-session desktop ;;
|
||||
oneshot)
|
||||
systemctl --user unmask cachyos-gamescope-autologin.service
|
||||
pkexec /usr/lib/steamos/steam-set-session gamescope-session.desktop ;;
|
||||
@@ -28,7 +30,9 @@ case "$1" in
|
||||
pkexec /usr/lib/steamos/steam-set-session gamescope-session.desktop
|
||||
relogin ;;
|
||||
desktop|plasma|gnome)
|
||||
pkexec /usr/lib/steamos/steam-set-session "$DESKTOP_SESSION"
|
||||
# desktop: the preferred one; plasma or gnome: that one.
|
||||
case "$1" in plasma) target=plasma.desktop ;; gnome) target=gnome.desktop ;; *) target=desktop ;; esac
|
||||
pkexec /usr/lib/steamos/steam-set-session "$target"
|
||||
steam -shutdown || true
|
||||
systemctl --user stop gamescope-session.target || true
|
||||
# Under GDM nothing logs in again by itself after the session ends.
|
||||
|
||||
@@ -9,6 +9,38 @@ DM_ID="$(systemctl show -p Id --value display-manager)"
|
||||
DM_ID="${DM_ID%.service}"
|
||||
SESSION="${1:-gamescope-session.desktop}"
|
||||
|
||||
# "desktop" is the desktop to go back to: the one chosen in Steamify (/etc/steamify/desktop: kde, gnome or last),
|
||||
# else the one used last (recorded below when leaving it for gamescope), else whichever is installed.
|
||||
have_session() { [[ -f "/usr/share/wayland-sessions/$1" || -f "/usr/share/xsessions/$1" ]]; }
|
||||
resolve_desktop() {
|
||||
local pref last
|
||||
pref="$(cat /etc/steamify/desktop 2>/dev/null || true)"
|
||||
last="$(cat /var/lib/steamify/last-desktop 2>/dev/null || true)"
|
||||
[[ -z "$pref" || "$pref" == last ]] && pref="$last"
|
||||
case "$pref" in
|
||||
gnome) have_session gnome.desktop && { echo gnome.desktop; return; } ;;
|
||||
kde) have_session plasma.desktop && { echo plasma.desktop; return; } ;;
|
||||
esac
|
||||
have_session plasma.desktop && { echo plasma.desktop; return; }
|
||||
echo gnome.desktop
|
||||
}
|
||||
remember_desktop() {
|
||||
# Leaving a desktop for gamescope: which desktop it was (from the user's own session).
|
||||
local uid="${PKEXEC_UID:-}" id desktop
|
||||
[[ -n "$uid" ]] || return 0
|
||||
id="$(loginctl show-user "$uid" -p Display --value 2>/dev/null)"
|
||||
[[ -n "$id" ]] || return 0
|
||||
desktop="$(loginctl show-session "$id" -p Desktop --value 2>/dev/null | tr 'A-Z' 'a-z')"
|
||||
case "$desktop" in
|
||||
*gnome*) kind=gnome ;;
|
||||
*kde*|*plasma*) kind=kde ;;
|
||||
*) return 0 ;;
|
||||
esac
|
||||
mkdir -p /var/lib/steamify && echo "$kind" > /var/lib/steamify/last-desktop
|
||||
}
|
||||
[[ "$SESSION" == desktop ]] && SESSION="$(resolve_desktop)"
|
||||
[[ "$SESSION" == gamescope-session* ]] && remember_desktop
|
||||
|
||||
case "$DM_ID" in
|
||||
plasmalogin) CONF_FILE="/etc/plasmalogin.conf.d/zz-steamos-autologin.conf" ;;
|
||||
sddm) CONF_FILE="/etc/sddm.conf.d/zz-steamos-autologin.conf" ;;
|
||||
|
||||
+10
@@ -137,6 +137,16 @@ if [[ "$LIST" == true ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# --desktop kde|gnome|last: which desktop "Switch to Desktop" goes to (when both are installed).
|
||||
if [[ "${1:-}" == --desktop ]]; then
|
||||
case "${2:-}" in
|
||||
kde|gnome|last) ;;
|
||||
*) err "--desktop takes kde, gnome or last (the one you used last)"; exit 1 ;;
|
||||
esac
|
||||
desktop_pref_set "$2" || exit 1
|
||||
ok "Switch to Desktop goes to: $2."
|
||||
exit 0
|
||||
fi
|
||||
if [[ "$DEFAULTS" == true ]]; then
|
||||
RESTART_FOR_LOGIN=false
|
||||
REAPPLY=false
|
||||
|
||||
@@ -25,6 +25,9 @@ QtObject {
|
||||
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"] },
|
||||
gnometheme: { label: "SteamOS theme for GNOME", hint: "Vapor look, Ubuntu-style dock and desktop icons",
|
||||
body: "The Vapor look of SteamOS for GNOME: dark or light style with Vapor's blue, the Steam Deck wallpapers in Settings, the top bar in Vapor's panel color, and the extensions Ubuntu uses (Ubuntu Dock, desktop icons, tray icons, tiling).",
|
||||
changes: ["Colors for GTK4 apps and the shell (a stylesheet extension)", "Ubuntu Dock, Tiling Assistant, Desktop Icons NG, AppIndicator", "SteamOS wallpapers in GNOME Settings", "Window buttons with minimize and maximize", "Off: your settings and files are put back"] },
|
||||
glyphs: { label: "Steam Deck/Machine icons", hint: "Deck button icons in gaming mode",
|
||||
body: "Steam shows Steam Deck button icons in gaming mode.", changes: ["STEAM_GAMEPADUI_ARGS -steamos3"] },
|
||||
single: { label: "Single user mode", hint: "No password, lock screen or wallet prompts",
|
||||
|
||||
Reference in new issue
Block a user