mirror of
https://github.com/theupriser/steamify-cachyos.git
synced 2026-10-14 14:48:52 +02:00
Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a3fc9e4d8 | ||
|
|
b65cab4834 | ||
|
|
50a2f1c6c9 | ||
|
|
6010af0432 | ||
|
|
4dedb12b52 | ||
|
|
995c9d9d4e | ||
|
|
9a1a09dea0 | ||
|
|
457364df12 | ||
|
|
d0037e867b | ||
|
|
f21b37a77a | ||
|
|
4f095bd077 | ||
|
|
f2b5f84526 | ||
|
|
66a9d33210 |
No files matched your search
+1
-2
@@ -178,8 +178,7 @@ backend_apply() {
|
||||
|
||||
backend_sudo || return 1
|
||||
|
||||
LOGIN_MANAGER=plasmalogin
|
||||
[[ "${WANTED[single]}" == 1 ]] && LOGIN_MANAGER=sddm
|
||||
choose_login_manager
|
||||
local -a failed=()
|
||||
for c in "${TO_DISABLE[@]}"; do
|
||||
if backend_run_component "$c" disable; then feature_record "$c" disable; else failed+=("$c"); fi
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ boot_enable() {
|
||||
# the session into the base config; run it right away rather than rely
|
||||
# on its path unit, which could still be pending when the login manager
|
||||
# starts.
|
||||
service_file "$BOOT_UNIT_NAME" SESSION_SYNC="$SESSION_SYNC" | sudo tee "$BOOT_UNIT" > /dev/null
|
||||
service_file "$BOOT_UNIT_NAME" SESSION_SYNC="$SESSION_SYNC" DESKTOP_SESSION="$(desktop_session_file)" | sudo tee "$BOOT_UNIT" > /dev/null
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable "$BOOT_UNIT_NAME" || { err "Enabling $BOOT_UNIT_NAME failed."; return 1; }
|
||||
ok "Boots into the desktop from the next boot on (Return to Gaming Mode still works)."
|
||||
|
||||
+59
-2
@@ -23,7 +23,10 @@ create_desktop_shortcut() {
|
||||
# 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
|
||||
if [[ "$LOGIN_MANAGER" == "gdm" ]]; then
|
||||
# Its own steamos-session-select (lib/login-manager.sh) restarts GDM, through the helper and rule gdm_fix_install adds.
|
||||
:
|
||||
elif [[ "$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
|
||||
sudoers_tmp="$(mktemp)"
|
||||
@@ -40,6 +43,9 @@ EOF
|
||||
else
|
||||
sudo rm -f /etc/sudoers.d/gamescope-session-switch
|
||||
fi
|
||||
# GNOME shows no icons on the desktop: the application grid gets the shortcut too.
|
||||
gnome_app_shortcut=false
|
||||
[[ "$(desktop_kind)" == gnome ]] && gnome_app_shortcut=true
|
||||
|
||||
# SteamOS itself uses Valve's "gaming-return" icon (Steam logo with a
|
||||
# return arrow; the Deck-style arrow is only used on Steam Deck
|
||||
@@ -66,6 +72,14 @@ EOF
|
||||
|
||||
# Fix permissions for the target user and KDE Plasma desktop ecosystem
|
||||
chmod +x "$shortcut_path"
|
||||
if [[ "$gnome_app_shortcut" == true ]]; then
|
||||
mkdir -p "$user_home/.local/share/applications"
|
||||
cp "$shortcut_path" "$user_home/.local/share/applications/steamify-return-to-gaming-mode.desktop"
|
||||
# GNOME only starts launchers it trusts.
|
||||
gio set "$shortcut_path" metadata::trusted true 2>/dev/null || true
|
||||
gnome_dash_pin
|
||||
gnome_extensions_enable
|
||||
fi
|
||||
|
||||
ok "Desktop shortcut created successfully."
|
||||
}
|
||||
@@ -81,6 +95,49 @@ set_shortcut_icon() {
|
||||
remove_desktop_shortcut() {
|
||||
local desktop_dir
|
||||
desktop_dir="$(xdg-user-dir DESKTOP 2>/dev/null || echo "$HOME/Desktop")"
|
||||
rm -f "$desktop_dir/Return to Gaming Mode.desktop"
|
||||
rm -f "$desktop_dir/Return to Gaming Mode.desktop" "$HOME/.local/share/applications/steamify-return-to-gaming-mode.desktop"
|
||||
gnome_dash_unpin
|
||||
sudo rm -f /etc/sudoers.d/gamescope-session-switch
|
||||
}
|
||||
|
||||
# GNOME draws no icons on the desktop: the shortcut is pinned to the dash
|
||||
# (the favorites bar) as well. Only in a running session (gsettings needs its dconf).
|
||||
GNOME_SHORTCUT_ID=steamify-return-to-gaming-mode.desktop
|
||||
|
||||
gnome_dash_pin() {
|
||||
user_session && command -v gsettings >/dev/null || return 0
|
||||
local favorites
|
||||
favorites="$(gsettings get org.gnome.shell favorite-apps 2>/dev/null)" || return 0
|
||||
[[ "$favorites" == *"$GNOME_SHORTCUT_ID"* ]] && return 0
|
||||
favorites="$(sed "s/\]\$/, '$GNOME_SHORTCUT_ID']/; s/^\[, /[/; s/\[\], /[/" <<< "$favorites")"
|
||||
[[ "$favorites" == "[ '$GNOME_SHORTCUT_ID']" ]] && favorites="['$GNOME_SHORTCUT_ID']"
|
||||
gsettings set org.gnome.shell favorite-apps "$favorites"
|
||||
}
|
||||
|
||||
gnome_dash_unpin() {
|
||||
user_session && command -v gsettings >/dev/null || return 0
|
||||
local favorites
|
||||
favorites="$(gsettings get org.gnome.shell favorite-apps 2>/dev/null)" || return 0
|
||||
[[ "$favorites" == *"$GNOME_SHORTCUT_ID"* ]] || return 0
|
||||
favorites="$(sed -e "s/, '$GNOME_SHORTCUT_ID'//; s/'$GNOME_SHORTCUT_ID', //; s/'$GNOME_SHORTCUT_ID'//" <<< "$favorites")"
|
||||
gsettings set org.gnome.shell favorite-apps "$favorites"
|
||||
}
|
||||
|
||||
# GNOME draws no desktop icons and no tray icons (Steam's, for one) itself:
|
||||
# the Desktop Icons NG and AppIndicator extensions, installed with the other
|
||||
# GNOME packages (lib/packages.sh). Enabled in the user's settings; GNOME
|
||||
# loads a new extension at the next login.
|
||||
GNOME_EXTENSIONS=(ding@rastersoft.com appindicatorsupport@rgcjonas.gmail.com)
|
||||
|
||||
gnome_extensions_enable() {
|
||||
user_session && command -v gsettings >/dev/null || return 0
|
||||
local uuid enabled
|
||||
for uuid in "${GNOME_EXTENSIONS[@]}"; do
|
||||
[[ -d "/usr/share/gnome-shell/extensions/$uuid" ]] || continue
|
||||
enabled="$(gsettings get org.gnome.shell enabled-extensions 2>/dev/null)" || return 0
|
||||
[[ "$enabled" == *"$uuid"* ]] && continue
|
||||
if [[ "$enabled" == "@as []" || "$enabled" == "[]" ]]; then enabled="['$uuid']"
|
||||
else enabled="${enabled%]}, '$uuid']"; fi
|
||||
gsettings set org.gnome.shell enabled-extensions "$enabled"
|
||||
done
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
# Which desktop Steamify is running on (KDE Plasma or GNOME), and the
|
||||
# session the login manager has to start for it. GNOME (GDM) is a prototype.
|
||||
# Sourced by steamify.sh; not meant to be run on its own.
|
||||
|
||||
desktop_kind() {
|
||||
# gnome or kde: the running session first, else what the login manager
|
||||
# is (GDM means GNOME), else KDE, which Steamify was made for.
|
||||
case ":${STEAMIFY_DESKTOP:-${XDG_CURRENT_DESKTOP:-}}:" in
|
||||
*:GNOME:*|*:gnome:*) echo gnome; return ;;
|
||||
*:KDE:*|*:kde:*) echo kde; return ;;
|
||||
esac
|
||||
[[ "$(current_display_manager)" == gdm ]] && { echo gnome; return; }
|
||||
echo kde
|
||||
}
|
||||
|
||||
desktop_session_file() {
|
||||
# The login manager's session entry for the desktop: plasma.desktop, or
|
||||
# whichever GNOME one is installed (gnome.desktop, gnome-xorg.desktop).
|
||||
local f
|
||||
if [[ "$(desktop_kind)" == gnome ]]; then
|
||||
# The plain session, not GNOME Classic (gnome-classic.desktop, from gnome-shell-extensions) or Xorg's.
|
||||
for f in /usr/share/wayland-sessions/gnome.desktop /usr/share/xsessions/gnome.desktop \
|
||||
/usr/share/wayland-sessions/gnome-wayland.desktop; do
|
||||
[[ -f "$f" ]] && { basename "$f"; return; }
|
||||
done
|
||||
echo gnome.desktop
|
||||
else
|
||||
echo plasma.desktop
|
||||
fi
|
||||
}
|
||||
|
||||
choose_login_manager() {
|
||||
# LOGIN_MANAGER for gaming_enable: gdm on GNOME, else sddm with single
|
||||
# user mode and plasmalogin without.
|
||||
if [[ "$(desktop_kind)" == gnome ]]; then LOGIN_MANAGER=gdm
|
||||
elif [[ "${WANTED[single]:-0}" == 1 ]]; then LOGIN_MANAGER=sddm
|
||||
else LOGIN_MANAGER=plasmalogin; fi
|
||||
}
|
||||
|
||||
desktop_installed() {
|
||||
# desktop_installed kde|gnome: its session is installed (both can be: the
|
||||
# menu then offers the theme of each).
|
||||
local name=plasma f
|
||||
[[ "$1" == gnome ]] && name=gnome
|
||||
for f in /usr/share/wayland-sessions/$name*.desktop /usr/share/xsessions/$name*.desktop; do
|
||||
[[ -f "$f" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
#!/bin/bash
|
||||
# SteamOS look for GNOME, the counterpart of lib/vapor-theme.sh: the Vapor
|
||||
# palette from CachyOS's cachyos-vapor package (also the Steam Deck
|
||||
# wallpapers), as dark mode, a blue accent, the wallpaper and libadwaita/GTK4
|
||||
# colors. Settings go through gsettings and its undo journal (lib/state.sh).
|
||||
# Sourced by steamify.sh; not meant to be run on its own.
|
||||
|
||||
GNOME_THEME_MARK="/* Steamify GNOME theme */"
|
||||
GNOME_THEME_CSS="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-4.0/gtk.css"
|
||||
# The Ubuntu-style look: the dock (Ubuntu Dock is Dash to Dock) and our own extension,
|
||||
# Steamify Vapor, which carries the shell colors (its stylesheet.css) and starts GNOME on
|
||||
# the desktop. (Desktop Icons NG and AppIndicator come with the conversion, lib/desktop-shortcut.sh.)
|
||||
GNOME_THEME_EXTENSIONS=(ubuntu-dock@ubuntu.com tiling-assistant@ubuntu.com steamify-vapor@steamify.github.io)
|
||||
# Ubuntu's own builds, the ones Ubuntu 26.04 ships (they are the more mature): Ubuntu Dock from its source tag
|
||||
# (built here: needs make, sassc and gettext) and Tiling Assistant (Ubuntu maintains it now) from its release.
|
||||
DOCK_URL="https://github.com/micheleg/dash-to-dock/archive/refs/tags/ubuntu-dock-109ubuntu2.tar.gz"
|
||||
DOCK_SHA256=599057fa27d922d4730bfc27c803b1b14b05f49a20e580e154e151b8481e5d41
|
||||
TILING_URL="https://github.com/ubuntu/Tiling-Assistant/releases/download/v56/tiling-assistant@leleat-on-github.shell-extension.zip"
|
||||
TILING_SHA256=961da0c6b8e5960770e68a06d71205765870435dbe8fe0ccc1ec50d4cc78265a
|
||||
GNOME_USER_EXTENSIONS="${XDG_DATA_HOME:-$HOME/.local/share}/gnome-shell/extensions"
|
||||
GNOME_THEME_WALLPAPER="/usr/share/wallpapers/Steam Deck Logo Default.jpg"
|
||||
|
||||
gnometheme_status() {
|
||||
grep -qsF "$GNOME_THEME_MARK" "$GNOME_THEME_CSS"
|
||||
}
|
||||
|
||||
gnometheme_extensions_install() {
|
||||
# Ubuntu Dock and Tiling Assistant (pinned downloads, checked) and our own Steamify Vapor, in the user's own extensions folder.
|
||||
local file work dir
|
||||
dir="$GNOME_USER_EXTENSIONS/ubuntu-dock@ubuntu.com"
|
||||
if [[ ! -f "$dir/metadata.json" ]]; then
|
||||
file="$(mktemp --suffix=.tar.gz)"; work="$(mktemp -d)"
|
||||
sudo pacman -S --needed --noconfirm make sassc gettext >/dev/null 2>&1
|
||||
if curl -fsSL --max-time 60 "$DOCK_URL" -o "$file" && [[ "$(sha256sum < "$file")" == "$DOCK_SHA256 -" ]] &&
|
||||
tar xzf "$file" -C "$work" --strip-components=1 &&
|
||||
make -C "$work" install-local INSTALLBASE="$GNOME_USER_EXTENSIONS" >/dev/null 2>&1; then
|
||||
:
|
||||
else
|
||||
warn "Couldn't set up Ubuntu Dock; the dock stays off."
|
||||
fi
|
||||
rm -rf "$file" "$work"
|
||||
fi
|
||||
dir="$GNOME_USER_EXTENSIONS/tiling-assistant@ubuntu.com"
|
||||
if [[ ! -f "$dir/metadata.json" ]]; then
|
||||
file="$(mktemp --suffix=.zip)"
|
||||
if curl -fsSL --max-time 60 "$TILING_URL" -o "$file" && [[ "$(sha256sum < "$file")" == "$TILING_SHA256 -" ]]; then
|
||||
rm -rf "$dir"; mkdir -p "$dir"
|
||||
python3 -c 'import sys,zipfile;zipfile.ZipFile(sys.argv[1]).extractall(sys.argv[2])' "$file" "$dir"
|
||||
# Under the name Ubuntu gives it (GNOME Settings' desktop panel looks for it).
|
||||
sed -i 's|"uuid": "tiling-assistant@leleat-on-github"|"uuid": "tiling-assistant@ubuntu.com"|' "$dir/metadata.json"
|
||||
glib-compile-schemas "$dir/schemas" 2>/dev/null
|
||||
else
|
||||
warn "Couldn't download Tiling Assistant; it stays off."
|
||||
fi
|
||||
rm -f "$file"
|
||||
fi
|
||||
dir="$GNOME_USER_EXTENSIONS/steamify-vapor@steamify.github.io"
|
||||
mkdir -p "$dir"
|
||||
patch_file steamify-vapor.js > "$dir/extension.js"
|
||||
patch_file steamify-vapor.json > "$dir/metadata.json"
|
||||
patch_file steamify-gnome-shell.css > "$dir/stylesheet.css"
|
||||
}
|
||||
|
||||
gnometheme_backgrounds() {
|
||||
# The SteamOS wallpapers of cachyos-vapor in GNOME Settings' background list: its XML list in the user's folder.
|
||||
local xml="${XDG_DATA_HOME:-$HOME/.local/share}/gnome-background-properties/steamify-steamos.xml" f name
|
||||
mkdir -p "$(dirname "$xml")"
|
||||
{
|
||||
printf '%s\n' '<?xml version="1.0"?>' '<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">' '<wallpapers>'
|
||||
for f in /usr/share/wallpapers/*.jpg; do
|
||||
[[ -f "$f" ]] || continue
|
||||
name="$(basename "$f" .jpg)"
|
||||
printf ' <wallpaper deleted="false">\n <name>SteamOS: %s</name>\n <filename>%s</filename>\n <filename-dark>%s</filename-dark>\n <options>zoom</options>\n <pcolor>#24272c</pcolor>\n <scolor>#24272c</scolor>\n <shade_type>solid</shade_type>\n </wallpaper>\n' "$name" "$f" "$f"
|
||||
done
|
||||
echo '</wallpapers>'
|
||||
} > "$xml"
|
||||
}
|
||||
|
||||
gnometheme_shell() {
|
||||
# The top bar and dash colors (the Steamify Vapor extension), and the dock beside it.
|
||||
gnometheme_extensions_install
|
||||
gnometheme_backgrounds
|
||||
# Like Ubuntu's dock: on the left, always there; its look is Ubuntu's own, left as it is. Its shape (a
|
||||
# panel to the screen edge or floating) is left to the user: Dock Settings.
|
||||
local d=org.gnome.shell.extensions.dash-to-dock
|
||||
gset gnometheme $d dock-position "'LEFT'" || true
|
||||
gset gnometheme $d dock-fixed true || true
|
||||
gset gnometheme $d running-indicator-style "'DOTS'" || true
|
||||
gset gnometheme $d click-action "'minimize-or-previews'" || true
|
||||
# Trash is in the dock, not on the desktop (Ubuntu does the same).
|
||||
gset gnometheme org.gnome.shell.extensions.ding show-trash false || true
|
||||
gset gnometheme $d show-trash true || true
|
||||
local uuid enabled
|
||||
for uuid in "${GNOME_THEME_EXTENSIONS[@]}"; do
|
||||
enabled="$(gs get org.gnome.shell enabled-extensions 2>/dev/null)" || return 0
|
||||
[[ "$enabled" == *"$uuid"* ]] && continue
|
||||
if [[ "$enabled" == "@as []" || "$enabled" == "[]" ]]; then enabled="['$uuid']"
|
||||
else enabled="${enabled%]}, '$uuid']"; fi
|
||||
gset gnometheme org.gnome.shell enabled-extensions "$enabled"
|
||||
done
|
||||
}
|
||||
|
||||
gnometheme_enable() {
|
||||
if ! pacman -Q cachyos-vapor >/dev/null 2>&1; then
|
||||
info "Installing cachyos-vapor (its wallpapers and colors)..."
|
||||
sudo pacman -S --needed --noconfirm cachyos-vapor || { err "Installing cachyos-vapor failed."; return 1; }
|
||||
# Only remove it again on disable if we were the ones installing it.
|
||||
state_set gnometheme installed_pkg 1
|
||||
fi
|
||||
info "Applying the SteamOS look to GNOME..."
|
||||
gset gnometheme org.gnome.desktop.interface color-scheme "'prefer-dark'"
|
||||
gset gnometheme org.gnome.desktop.interface accent-color "'blue'" || true
|
||||
gset gnometheme org.gnome.desktop.interface gtk-theme "'Vapor'" || true
|
||||
# Windows with minimize and maximize buttons, like Ubuntu (GNOME shows only close by default).
|
||||
gset gnometheme org.gnome.desktop.wm.preferences button-layout "'appmenu:minimize,maximize,close'" || true
|
||||
if [[ -f "$GNOME_THEME_WALLPAPER" ]]; then
|
||||
local uri="file://${GNOME_THEME_WALLPAPER// /%20}"
|
||||
gset gnometheme org.gnome.desktop.background picture-uri "'$uri'"
|
||||
gset gnometheme org.gnome.desktop.background picture-uri-dark "'$uri'" || true
|
||||
gset gnometheme org.gnome.desktop.background picture-options "'zoom'"
|
||||
fi
|
||||
# GTK4/libadwaita apps ignore GTK themes: their colors come from this file.
|
||||
mkdir -p "$(dirname "$GNOME_THEME_CSS")"
|
||||
if [[ -f "$GNOME_THEME_CSS" ]] && ! gnometheme_status; then
|
||||
cp -a "$GNOME_THEME_CSS" "$STATE_DIR/gnometheme-gtk4.css"
|
||||
fi
|
||||
{ echo "$GNOME_THEME_MARK"; patch_file steamify-gnome-gtk4.css; } > "$GNOME_THEME_CSS"
|
||||
gnometheme_shell
|
||||
ok "SteamOS theme for GNOME on (apps pick up the colors when they start again)."
|
||||
}
|
||||
|
||||
gnometheme_disable() {
|
||||
info "Restoring GNOME's previous look..."
|
||||
grevert gnometheme
|
||||
# (The Dock/Desktop Icons/Tiling Settings launchers of earlier prototypes.)
|
||||
rm -f "${XDG_DATA_HOME:-$HOME/.local/share}"/applications/steamify-{dock,icons,tiling}-settings.desktop \
|
||||
"${XDG_DATA_HOME:-$HOME/.local/share}/gnome-background-properties/steamify-steamos.xml"
|
||||
rm -rf "$GNOME_USER_EXTENSIONS/steamify-vapor@steamify.github.io" "$GNOME_USER_EXTENSIONS/ubuntu-dock@ubuntu.com" "$GNOME_USER_EXTENSIONS/tiling-assistant@ubuntu.com"
|
||||
if [[ -f "$STATE_DIR/gnometheme-gtk4.css" ]]; then
|
||||
mv -f "$STATE_DIR/gnometheme-gtk4.css" "$GNOME_THEME_CSS"
|
||||
else
|
||||
gnometheme_status && rm -f "$GNOME_THEME_CSS"
|
||||
fi
|
||||
if [[ -n "$(state_get gnometheme installed_pkg)" ]]; then
|
||||
# Fails, and stays installed, when the KDE theme or another package needs it.
|
||||
sudo pacman -R --noconfirm cachyos-vapor >/dev/null 2>&1 ||
|
||||
info "Keeping cachyos-vapor installed (another package needs it)."
|
||||
fi
|
||||
state_clear gnometheme
|
||||
ok "Previous GNOME look restored."
|
||||
}
|
||||
+95
-2
@@ -4,6 +4,11 @@
|
||||
# Sourced by steamify.sh; not meant to be run on its own.
|
||||
|
||||
BASE_CONF="/etc/plasmalogin.conf"
|
||||
GDM_CONF="/etc/gdm/custom.conf"
|
||||
GDM_FIX_DIR=/usr/local/share/steamify-gdm
|
||||
GDM_HOOK=/etc/pacman.d/hooks/95-steamify-gdm.hook
|
||||
GDM_SUDOERS=/etc/sudoers.d/steamify-gdm-relogin
|
||||
GDM_RELOGIN=/usr/local/libexec/steamify-gdm-relogin
|
||||
|
||||
# The "SteamOS conversion" menu item: gaming mode boot, the Return to
|
||||
# Gaming Mode shortcut and Steam on the desktop (lib/steam-desktop.sh).
|
||||
@@ -14,6 +19,9 @@ gaming_status() {
|
||||
plasmalogin)
|
||||
sed -n '/^\[Autologin\]/,/^\[/p' "$BASE_CONF" 2>/dev/null | grep -qx "User=$USER" &&
|
||||
[[ -f /etc/systemd/system/sync-steamos-session.path ]] ;;
|
||||
gdm)
|
||||
sed -n '/^\[daemon\]/,/^\[/p' /etc/gdm/custom.conf 2>/dev/null | grep -qx "AutomaticLogin=$USER" &&
|
||||
[[ -f "$GDM_FIX_DIR/steam-set-session" ]] ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
@@ -108,6 +116,14 @@ gaming_enable() {
|
||||
configure_autologin
|
||||
install_session_sync
|
||||
;;
|
||||
gdm)
|
||||
# GNOME (prototype): GDM autologin, plus CachyOS's session tools made GDM-aware.
|
||||
remove_sddm_autologin
|
||||
remove_session_sync
|
||||
switch_to_gdm || return 1
|
||||
configure_gdm_autologin || return 1
|
||||
gdm_fix_install || return 1
|
||||
;;
|
||||
esac
|
||||
# (NVIDIA with single user mode from before the conversion: its desktop autologin would pin the Plasma session.)
|
||||
single_login_release
|
||||
@@ -122,8 +138,13 @@ gaming_disable() {
|
||||
info "Turning off booting into gaming mode..."
|
||||
remove_sddm_autologin
|
||||
remove_session_sync
|
||||
restore_plasmalogin_config
|
||||
switch_to_plasmalogin
|
||||
if [[ "$(current_display_manager)" == gdm ]]; then
|
||||
gdm_fix_remove
|
||||
restore_gdm_config
|
||||
else
|
||||
restore_plasmalogin_config
|
||||
switch_to_plasmalogin
|
||||
fi
|
||||
remove_desktop_shortcut
|
||||
steam_disable
|
||||
gsn_disable
|
||||
@@ -297,3 +318,75 @@ install_session_sync() {
|
||||
sudo cat "$BASE_CONF"
|
||||
echo
|
||||
}
|
||||
|
||||
switch_to_gdm() {
|
||||
# Already the login manager on a GNOME install; this only makes sure it is installed and enabled.
|
||||
[[ "$(current_display_manager)" == gdm ]] && return 0
|
||||
info "Installing and enabling GDM..."
|
||||
sudo pacman -S --needed --noconfirm gdm || { err "Installing gdm failed."; return 1; }
|
||||
local current
|
||||
current="$(systemctl show -p Id --value display-manager 2>/dev/null)"
|
||||
[[ -n "$current" && "$current" != gdm.service ]] && sudo systemctl disable "$current"
|
||||
sudo systemctl enable -f gdm.service || { err "Enabling gdm failed."; return 1; }
|
||||
ok "GDM is the login manager from the next boot on."
|
||||
}
|
||||
|
||||
configure_gdm_autologin() {
|
||||
# [daemon] AutomaticLogin: GDM reads it when it starts, which is why the
|
||||
# session tools restart GDM to log in again (see patches/steamify-gdm-session-select.sh).
|
||||
info "Configuring GDM autologin for $TARGET_USER"
|
||||
sudo mkdir -p /etc/gdm
|
||||
sudo touch "$GDM_CONF"
|
||||
[[ -f "$GDM_CONF.bak-steamify" ]] || sudo cp -a "$GDM_CONF" "$GDM_CONF.bak-steamify"
|
||||
sudo awk '
|
||||
/^\[daemon\]/ { print; indaemon=1; next }
|
||||
/^\[/ { indaemon=0 }
|
||||
indaemon && /^(AutomaticLoginEnable|AutomaticLogin)=/ { next }
|
||||
{ print }
|
||||
' "$GDM_CONF" | sudo tee "$GDM_CONF.tmp" > /dev/null
|
||||
grep -q '^\[daemon\]' "$GDM_CONF.tmp" || printf '[daemon]\n' | sudo tee -a "$GDM_CONF.tmp" > /dev/null
|
||||
sudo sed -i "/^\[daemon\]/a AutomaticLoginEnable=True\nAutomaticLogin=$TARGET_USER" "$GDM_CONF.tmp"
|
||||
sudo mv "$GDM_CONF.tmp" "$GDM_CONF"
|
||||
ok "GDM autologin configured."
|
||||
}
|
||||
|
||||
restore_gdm_config() {
|
||||
if [[ -f "$GDM_CONF.bak-steamify" ]]; then
|
||||
sudo cp -a "$GDM_CONF.bak-steamify" "$GDM_CONF" && sudo rm -f "$GDM_CONF.bak-steamify"
|
||||
else
|
||||
sudo sed -i '/^AutomaticLoginEnable=/d;/^AutomaticLogin=/d' "$GDM_CONF" 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
gdm_fix_install() {
|
||||
# CachyOS's steam-set-session and steamos-session-select only know
|
||||
# plasma-login-manager/SDDM and KDE. Ours replace them at the same paths
|
||||
# (Steam's Switch to Desktop calls them by path); a pacman hook puts them
|
||||
# back after every update of gamescope-session-cachyos.
|
||||
info "Making the session switching GDM-aware..."
|
||||
sudo mkdir -p "$GDM_FIX_DIR"
|
||||
patch_file steamify-gdm-steam-set-session.sh | sudo install -Dm755 /dev/stdin "$GDM_FIX_DIR/steam-set-session" &&
|
||||
patch_file steamify-gdm-session-select.sh | fill DESKTOP_SESSION="$(desktop_session_file)" |
|
||||
sudo install -Dm755 /dev/stdin "$GDM_FIX_DIR/steamos-session-select" || { err "Installing the GDM session tools failed."; return 1; }
|
||||
patch_file steamify-gdm.hook | fill DIR="$GDM_FIX_DIR" | sudo install -Dm644 /dev/stdin "$GDM_HOOK"
|
||||
# steamos-session-select logs in again through this helper (no password: it runs from the gaming session and from a shortcut).
|
||||
patch_file steamify-gdm-relogin.sh | sudo install -Dm755 /dev/stdin "$GDM_RELOGIN"
|
||||
echo "$TARGET_USER ALL=(root) NOPASSWD: $GDM_RELOGIN" | sudo install -Dm440 /dev/stdin "$GDM_SUDOERS"
|
||||
sudo visudo -cf "$GDM_SUDOERS" > /dev/null || { sudo rm -f "$GDM_SUDOERS"; err "The sudoers rule for GDM is invalid."; return 1; }
|
||||
for f in /usr/lib/steamos/steam-set-session /usr/bin/steamos-session-select; do
|
||||
[[ -f "$f" && ! -f "$f.bak-steamify" ]] && sudo cp -a "$f" "$f.bak-steamify"
|
||||
done
|
||||
sudo install -m755 "$GDM_FIX_DIR/steam-set-session" /usr/lib/steamos/steam-set-session &&
|
||||
sudo install -m755 "$GDM_FIX_DIR/steamos-session-select" /usr/bin/steamos-session-select || return 1
|
||||
# Start in gamescope, as with the other login managers.
|
||||
sudo /usr/lib/steamos/steam-set-session gamescope-session.desktop
|
||||
ok "GDM autologin into gamescope is set up."
|
||||
}
|
||||
|
||||
gdm_fix_remove() {
|
||||
sudo rm -f "$GDM_HOOK" "$GDM_SUDOERS" "$GDM_RELOGIN"
|
||||
for f in /usr/lib/steamos/steam-set-session /usr/bin/steamos-session-select; do
|
||||
[[ -f "$f.bak-steamify" ]] && sudo mv "$f.bak-steamify" "$f"
|
||||
done
|
||||
sudo rm -rf "$GDM_FIX_DIR"
|
||||
}
|
||||
+8
-4
@@ -5,7 +5,7 @@
|
||||
|
||||
# Menu order. Components are turned on in this order and off in reverse;
|
||||
# gaming must come first (single user builds on it).
|
||||
COMPONENTS=(gaming boot silent glyphs nvidia bigpicture nvsilent theme single launcher steamgame notify extended_controller_support vram cec machine poweroff kpin hdmi bios)
|
||||
COMPONENTS=(gaming boot silent glyphs nvidia bigpicture nvsilent theme gnometheme single launcher steamgame notify extended_controller_support vram cec machine poweroff kpin hdmi bios)
|
||||
# One-off actions rather than on/off components: never preselected, never
|
||||
# re-applied, not listed as on or off.
|
||||
ACTIONS=(bios)
|
||||
@@ -26,7 +26,7 @@ NO_PRESELECT=(boot silent nvsilent cec kpin hdmi extended_controller_support)
|
||||
# FEATURE_BASELINE.
|
||||
FEATURE_BASELINE=2.1.0
|
||||
declare -A FEATURE_VERSION=(
|
||||
[gaming]=2.9.0 [boot]=2.1.0 [silent]=2.11.0 [nvidia]=2.12.0 [bigpicture]=2.10.0 [nvsilent]=2.11.0 [theme]=2.1.0 [glyphs]=2.1.0 [single]=2.1.0
|
||||
[gaming]=2.9.0 [boot]=2.1.0 [silent]=2.11.0 [nvidia]=2.12.0 [bigpicture]=2.10.0 [nvsilent]=2.11.0 [theme]=2.1.0 [gnometheme]=2.12.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 [extended_controller_support]=2.10.0
|
||||
[kpin]=2.1.0 [hdmi]=2.1.0
|
||||
)
|
||||
@@ -39,6 +39,7 @@ declare -A LABEL=(
|
||||
[nvsilent]="Start Steam silently: in the tray at login, no window (untick: Steam's normal window)"
|
||||
[bigpicture]="Steam starts in Big Picture: the controller-friendly Steam (untick: Steam's normal window)"
|
||||
[theme]="Install SteamOS theme: Vapor look (cachyos-vapor)"
|
||||
[gnometheme]="Install SteamOS theme for GNOME: Vapor look (dark, blue accent, Steam Deck wallpaper)"
|
||||
[glyphs]="Install Steam Deck/Machine icons: Deck button icons in gaming mode"
|
||||
[single]="Single user mode: no password, lock screen or log out (SDDM)"
|
||||
[launcher]="Steamify shortcut: the app on the desktop, Steamify Terminal in the launcher"
|
||||
@@ -60,6 +61,10 @@ component_available() {
|
||||
# The SteamOS conversion is offered on NVIDIA PCs too: it installs the patched gamescope there (lib/gamescope-nvidia.sh)
|
||||
# and turns off "Gaming on NVIDIA" (lib/nvidia.sh), which is not offered any more (nvidia_available).
|
||||
nvidia|bigpicture|nvsilent) nvidia_available ;;
|
||||
# Plasma's Vapor theme and single user mode (KDE Wallet, screen locker, Plasma's menu): when Plasma is installed.
|
||||
# The GNOME theme: when GNOME is. With both installed, each shows.
|
||||
theme|single) desktop_installed kde ;;
|
||||
gnometheme) desktop_installed gnome ;;
|
||||
machine|poweroff) machine_available ;;
|
||||
vram) vram_available ;;
|
||||
# Steamify in the Steam library is for gaming mode's controller: not needed for Big Picture on the desktop (NVIDIA PCs;
|
||||
@@ -503,8 +508,7 @@ plan_changes() {
|
||||
|
||||
apply_changes() {
|
||||
local c failed=()
|
||||
LOGIN_MANAGER=plasmalogin
|
||||
[[ "${WANTED[single]}" == 1 ]] && LOGIN_MANAGER=sddm
|
||||
choose_login_manager
|
||||
|
||||
for c in "${TO_DISABLE[@]}"; do
|
||||
if [[ "$c" == boot ]]; then echo; echo -e "${c_bold}Boot into: gamescope${c_reset}"
|
||||
|
||||
+5
-3
@@ -84,9 +84,11 @@ python_hid_shim_ensure() {
|
||||
|
||||
install_required_packages() {
|
||||
# Step 2: gamescope/Steam and the desktop helpers the rest of the setup uses.
|
||||
local -a MISSING
|
||||
info "Checking required packages: gamescope-session-cachyos, steam, mangohud, xterm, ttf-liberation, wqy-zenhei, plasma-keyboard"
|
||||
mapfile -t MISSING < <(pacman -T gamescope-session-cachyos steam mangohud xterm ttf-liberation wqy-zenhei plasma-keyboard)
|
||||
local -a MISSING required=(gamescope-session-cachyos steam mangohud xterm ttf-liberation wqy-zenhei)
|
||||
# Plasma's on-screen keyboard; on GNOME kconfig instead, for the kreadconfig6/kwriteconfig6 Steamify's undo journal uses.
|
||||
if [[ "$(desktop_kind)" == gnome ]]; then required+=(kconfig accountsservice gnome-shell-extension-desktop-icons-ng gnome-shell-extension-appindicator extension-manager); else required+=(plasma-keyboard); fi
|
||||
info "Checking required packages: ${required[*]}"
|
||||
mapfile -t MISSING < <(pacman -T "${required[@]}")
|
||||
|
||||
if [[ ${#MISSING[@]} -gt 0 ]]; then
|
||||
python_hid_shim_ensure || return 1
|
||||
|
||||
@@ -59,6 +59,40 @@ krevert() {
|
||||
rm -f "$journal"
|
||||
}
|
||||
|
||||
gs() {
|
||||
# gsettings, also without a session (the installer's chroot): then in a
|
||||
# session bus of its own, which writes the user's dconf database.
|
||||
if user_session; then gsettings "$@"; else dbus-run-session -- gsettings "$@"; fi
|
||||
}
|
||||
|
||||
gset() {
|
||||
# gset <component> <schema> <key> <value>: gsettings (GNOME), recording the
|
||||
# old value in the component's journal like kset does. <value> is in
|
||||
# GVariant text form ('prefer-dark', true, 5). A key the schema lacks
|
||||
# (newer GNOME only) is skipped, returning 1.
|
||||
local component="$1" schema="$2" key="$3" value="$4"
|
||||
local journal="$STATE_DIR/$component.gjournal" old id
|
||||
gs get "$schema" "$key" >/dev/null 2>&1 || return 1
|
||||
mkdir -p "$STATE_DIR"
|
||||
id="$(printf '%s\t%s' "$schema" "$key")"
|
||||
if ! grep -qxF -- "$id" <(cut -f1-2 "$journal" 2>/dev/null); then
|
||||
old="$(gs get "$schema" "$key")"
|
||||
printf '%s\t%s\n' "$id" "$(printf '%s' "$old" | base64 -w0)" >> "$journal"
|
||||
fi
|
||||
gs set "$schema" "$key" "$value"
|
||||
}
|
||||
|
||||
grevert() {
|
||||
# grevert <component>: put back every gsettings key the component changed.
|
||||
local journal="$STATE_DIR/$1.gjournal" schema key old
|
||||
[[ -f "$journal" ]] || return 0
|
||||
while IFS=$'\t' read -r schema key old; do
|
||||
old="$(printf '%s' "$old" | base64 -d)"
|
||||
gs set "$schema" "$key" "$old" 2>/dev/null || gs reset "$schema" "$key" 2>/dev/null
|
||||
done < <(tac "$journal")
|
||||
rm -f "$journal"
|
||||
}
|
||||
|
||||
has_journal() {
|
||||
[[ -s "$STATE_DIR/$1.journal" ]]
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ steam_enable() {
|
||||
steam_env_dir="$HOME/.config/environment.d"
|
||||
mkdir -p "$steam_env_dir"
|
||||
|
||||
# 2. Prevent KDE Wayland from blocking the virtual keyboard overlay
|
||||
echo "KWIN_IM_SHOW_ALWAYS=1" > "$steam_env_dir/99-kde-virtual-keyboard.conf"
|
||||
# 2. Prevent KDE Wayland from blocking the virtual keyboard overlay (KWin only)
|
||||
[[ "$(desktop_kind)" == kde ]] && echo "KWIN_IM_SHOW_ALWAYS=1" > "$steam_env_dir/99-kde-virtual-keyboard.conf"
|
||||
|
||||
ok "Steam UI parameters and keyboard fix deployed successfully."
|
||||
}
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ theme_disable() {
|
||||
restart_plasmashell_if_stopped
|
||||
qdbus6 org.kde.KWin /KWin org.kde.KWin.reconfigure >/dev/null 2>&1 || true
|
||||
|
||||
if [[ -n "$(state_get theme installed_pkg)" ]]; then
|
||||
if [[ -n "$(state_get theme installed_pkg)" ]] && ! gnometheme_status; then
|
||||
# Fails, and stays installed, when another package (e.g.
|
||||
# cachyos-handheld) depends on it.
|
||||
sudo pacman -R --noconfirm cachyos-vapor >/dev/null 2>&1 ||
|
||||
|
||||
+20
-4
@@ -22,6 +22,18 @@ WIZARD_TERMINAL_ENTRY="$WIZARD_APPS/steamify-terminal.desktop"
|
||||
# Before 2.0.1 the shortcut opened the terminal menu under this name.
|
||||
WIZARD_OLD_NAME="cachyos-gamescope-boot-wizard.desktop"
|
||||
|
||||
wizard_terminal() {
|
||||
# The command prefix that runs a program in a terminal window: Konsole on
|
||||
# Plasma, on GNOME whichever of Ptyxis, Console or GNOME Terminal is there.
|
||||
if [[ "$(desktop_kind)" == gnome ]]; then
|
||||
if command -v ptyxis >/dev/null; then echo "ptyxis --"
|
||||
elif command -v kgx >/dev/null; then echo "kgx -e"
|
||||
else echo "gnome-terminal --"; fi
|
||||
else
|
||||
echo "konsole -e"
|
||||
fi
|
||||
}
|
||||
|
||||
wizard_desktop_dir() {
|
||||
xdg-user-dir DESKTOP 2>/dev/null || echo "$HOME/Desktop"
|
||||
}
|
||||
@@ -47,6 +59,8 @@ launcher_status() {
|
||||
launcher_repair() { [[ -f "$WIZARD_APPS/$WIZARD_OLD_NAME" ]] && ! launcher_status; }
|
||||
|
||||
launcher_enable() {
|
||||
local terminal
|
||||
terminal="$(wizard_terminal)"
|
||||
info "Adding the Steamify shortcut (the app on the desktop and in the launcher, Steamify Terminal in the launcher)..."
|
||||
install_executable "$WIZARD_LAUNCHER" 755 << EOF
|
||||
#!/bin/bash
|
||||
@@ -70,18 +84,18 @@ echo
|
||||
EOF
|
||||
|
||||
# The app, without a terminal. Only the first time, when PySide6 still
|
||||
# has to be installed, it runs in Konsole: sudo asks for the password there.
|
||||
# has to be installed, it runs in a terminal: sudo asks for the password there.
|
||||
install_executable "$WIZARD_APP_LAUNCHER" 755 << EOF
|
||||
#!/bin/bash
|
||||
# Installed by Steamify CachyOS: start the newest release of its app.
|
||||
set -o pipefail
|
||||
if [[ "\${1:-}" != --in-terminal ]] && ! python3 -c 'import PySide6.QtQml' 2>/dev/null; then
|
||||
exec konsole -e "\$0" --in-terminal
|
||||
exec $terminal "\$0" --in-terminal
|
||||
fi
|
||||
if ! curl -fsSL --max-time 30 "$WIZARD_APP_URL" | bash; then
|
||||
msg="Couldn't download or start Steamify. Are you connected to the internet?"
|
||||
if [[ "\${1:-}" == --in-terminal ]]; then echo; echo "\$msg"; read -rp "Press Enter to close this window... " _
|
||||
else kdialog --title Steamify --sorry "\$msg" 2>/dev/null; fi
|
||||
else kdialog --title Steamify --sorry "\$msg" 2>/dev/null || zenity --error --title Steamify --text "\$msg" 2>/dev/null; fi
|
||||
exit 1
|
||||
fi
|
||||
EOF
|
||||
@@ -110,11 +124,13 @@ Categories=Game;System;Settings;
|
||||
X-Steamify-Shortcut=true"
|
||||
printf '%s\n' "$entry" | install_executable "$WIZARD_APP_ENTRY" 644
|
||||
printf '%s\n' "$entry" | install_executable "$(wizard_desktop_dir)/$WIZARD_DESKTOP_NAME" 755
|
||||
# GNOME only starts desktop launchers it trusts.
|
||||
gio set "$(wizard_desktop_dir)/$WIZARD_DESKTOP_NAME" metadata::trusted true 2>/dev/null || true
|
||||
printf '%s\n' "[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Steamify Terminal
|
||||
Comment=Steamify CachyOS's menu in a terminal
|
||||
Exec=konsole -e $WIZARD_LAUNCHER
|
||||
Exec=$terminal $WIZARD_LAUNCHER
|
||||
Icon=$icon
|
||||
Terminal=false
|
||||
Categories=Game;System;Settings;" | install_executable "$WIZARD_TERMINAL_ENTRY" 644
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
# Log the autologin user in again, into the session steam-set-session picked
|
||||
# (Steamify prototype, GDM). Run as root through sudo, from inside the session
|
||||
# that is being left. GDM logs in by itself only when the daemon starts, and
|
||||
# a new session refuses to start while the old user manager still runs
|
||||
# ("A graphical session is already running!"): so the user is ended first,
|
||||
# then GDM restarted. That work runs in its own transient unit, because
|
||||
# ending the user kills this process too.
|
||||
if [[ "$1" != --work ]]; then
|
||||
[[ -n "${SUDO_USER:-}" ]] || exit 1
|
||||
exec systemd-run --no-block --collect --unit=steamify-gdm-relogin "$0" --work "$SUDO_USER"
|
||||
fi
|
||||
USER_NAME="$2"
|
||||
# GDM is stopped first, so its login screen doesn't show while the old user
|
||||
# manager shuts down; a new login right away fails ("A graphical session is
|
||||
# already running!", or the session dies at once), so wait until it is gone.
|
||||
systemctl stop gdm.service
|
||||
loginctl terminate-user "$USER_NAME"
|
||||
# (not `loginctl show-user`: it still lists the user about 10 s after it is gone)
|
||||
USER_RUNTIME="/run/user/$(id -u "$USER_NAME")"
|
||||
for _ in $(seq 120); do [[ -d "$USER_RUNTIME" ]] || break; sleep 0.25; done
|
||||
systemctl start gdm.service
|
||||
@@ -0,0 +1,45 @@
|
||||
#!/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
|
||||
# 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 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
persistent)
|
||||
systemctl --user mask cachyos-gamescope-autologin.service
|
||||
pkexec /usr/lib/steamos/steam-set-session "$DESKTOP_SESSION" ;;
|
||||
oneshot)
|
||||
systemctl --user unmask cachyos-gamescope-autologin.service
|
||||
pkexec /usr/lib/steamos/steam-set-session gamescope-session.desktop ;;
|
||||
gamescope)
|
||||
pkexec /usr/lib/steamos/steam-set-session gamescope-session.desktop
|
||||
relogin ;;
|
||||
desktop|plasma|gnome)
|
||||
pkexec /usr/lib/steamos/steam-set-session "$DESKTOP_SESSION"
|
||||
steam -shutdown || true
|
||||
systemctl --user stop gamescope-session.target || true
|
||||
# Under GDM nothing logs in again by itself after the session ends.
|
||||
[[ "$DM_ID" == gdm ]] && relogin ;;
|
||||
*)
|
||||
[[ -n "$1" ]] && echo -e "Unknown session '$1'\n"
|
||||
echo "Usage: $(basename "$0") persistent|oneshot|gamescope|desktop"
|
||||
exit 1 ;;
|
||||
esac
|
||||
|
||||
if [[ -e /dev/input/.hidden ]]; then
|
||||
pkexec mv /dev/input/.hidden/* /dev/input
|
||||
pkexec rm -r /dev/input/.hidden
|
||||
fi
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
# steam-set-session with GDM support (Steamify prototype). CachyOS's own only
|
||||
# knows plasma-login-manager and SDDM and quietly does nothing on GDM. GDM
|
||||
# has no autologin fragment: it takes the user's session from
|
||||
# AccountsService, so that is where the session goes.
|
||||
set -e
|
||||
|
||||
DM_ID="$(systemctl show -p Id --value display-manager)"
|
||||
DM_ID="${DM_ID%.service}"
|
||||
SESSION="${1:-gamescope-session.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" ;;
|
||||
gdm)
|
||||
if [[ -n "${PKEXEC_UID:-}" ]]; then TARGET_USER="$(id -un "$PKEXEC_UID")"
|
||||
else TARGET_USER="${SUDO_USER:-}"; fi
|
||||
# (|| true: logname fails without a login, and set -e would end the script before the fallback.)
|
||||
[[ -n "$TARGET_USER" ]] || TARGET_USER="$(logname 2>/dev/null || true)"
|
||||
# At boot (steamify-boot-desktop.service) nobody is logged in: the autologin user.
|
||||
[[ -n "$TARGET_USER" ]] || TARGET_USER="$(sed -n 's/^AutomaticLogin=//p' /etc/gdm/custom.conf 2>/dev/null)"
|
||||
[[ -n "$TARGET_USER" ]] || exit 0
|
||||
ACCOUNT="/var/lib/AccountsService/users/$TARGET_USER"
|
||||
SESSION_ID="${SESSION%.desktop}"
|
||||
mkdir -p /var/lib/AccountsService/users
|
||||
touch "$ACCOUNT"
|
||||
grep -q '^\[User\]' "$ACCOUNT" || echo "[User]" >> "$ACCOUNT"
|
||||
for key in Session XSession; do
|
||||
if grep -q "^$key=" "$ACCOUNT"; then sed -i "s|^$key=.*|$key=$SESSION_ID|" "$ACCOUNT"
|
||||
else sed -i "/^\[User\]/a $key=$SESSION_ID" "$ACCOUNT"; fi
|
||||
done
|
||||
systemctl restart accounts-daemon 2>/dev/null || true
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
# Any other login manager: nothing to do.
|
||||
[[ -n "${CONF_FILE:-}" ]] || exit 0
|
||||
mkdir -p "$(dirname "$CONF_FILE")"
|
||||
printf '[Autologin]\nSession=%s\n' "$SESSION" > "$CONF_FILE"
|
||||
@@ -0,0 +1,10 @@
|
||||
[Trigger]
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Type = Package
|
||||
Target = gamescope-session-cachyos
|
||||
|
||||
[Action]
|
||||
Description = Steamify: GDM support for gamescope-session-cachyos...
|
||||
When = PostTransaction
|
||||
Exec = /bin/sh -c 'install -m755 @DIR@/steam-set-session /usr/lib/steamos/steam-set-session && install -m755 @DIR@/steamos-session-select /usr/bin/steamos-session-select'
|
||||
@@ -0,0 +1,14 @@
|
||||
/* Steamify Vapor: libadwaita/GTK4 colors, from Vapor's palette (cachyos-vapor, Vapor.colors). */
|
||||
@define-color accent_bg_color #569fcc;
|
||||
@define-color accent_fg_color #1f1f26;
|
||||
@define-color accent_color #3daee9;
|
||||
@define-color window_bg_color #24272c;
|
||||
@define-color window_fg_color #eff0f1;
|
||||
@define-color view_bg_color #151c23;
|
||||
@define-color view_fg_color #eff0f1;
|
||||
@define-color headerbar_bg_color #24272c;
|
||||
@define-color headerbar_fg_color #eff0f1;
|
||||
@define-color card_bg_color #2a2e32;
|
||||
@define-color popover_bg_color #2a2e32;
|
||||
@define-color sidebar_bg_color #1f2328;
|
||||
@define-color dialog_bg_color #2a2e32;
|
||||
@@ -0,0 +1,44 @@
|
||||
/* Steamify Vapor: the SteamOS look for GNOME Shell, loaded by the Steamify Vapor
|
||||
* extension on top of the stock theme: the palette of the Vapor theme (KDE Plasma's SteamOS look, cachyos-vapor). */
|
||||
|
||||
/* Top bar: Vapor's panel color. */
|
||||
#panel,
|
||||
#panel.lock-screen,
|
||||
#panel.unlock-screen {
|
||||
background-color: #24272c;
|
||||
}
|
||||
#panel .panel-button { color: #eff0f1; }
|
||||
#panel .panel-button:hover,
|
||||
#panel .panel-button:focus,
|
||||
#panel .panel-button:active,
|
||||
#panel .panel-button:checked,
|
||||
#panel .panel-button:overview {
|
||||
background-color: rgba(86, 159, 204, 0.35);
|
||||
color: #eff0f1;
|
||||
}
|
||||
|
||||
/* Popups and the calendar (the dock keeps Ubuntu's own look). */
|
||||
.popup-menu-content,
|
||||
.candidate-popup-content,
|
||||
.message-list-clear-button {
|
||||
background-color: #24272c;
|
||||
}
|
||||
.popup-menu-item:hover,
|
||||
.popup-menu-item:focus,
|
||||
.popup-menu-item:active {
|
||||
background-color: rgba(86, 159, 204, 0.35);
|
||||
}
|
||||
|
||||
/* Selection and focus in Vapor's blue. */
|
||||
.app-well-app:focus .overview-icon,
|
||||
.app-well-app:selected .overview-icon,
|
||||
.overview-tile:focus,
|
||||
.overview-tile:selected,
|
||||
.search-entry:focus {
|
||||
background-color: rgba(86, 159, 204, 0.3);
|
||||
border-color: #3daee9;
|
||||
}
|
||||
.button:focus,
|
||||
.check-box:focus StBin { border-color: #3daee9; }
|
||||
.slider { color: #3daee9; }
|
||||
.workspace-thumbnail-indicator { border-color: #3daee9; }
|
||||
@@ -8,6 +8,7 @@
|
||||
import configparser
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
@@ -56,10 +57,20 @@ def pending(new):
|
||||
|
||||
|
||||
def desktop():
|
||||
# Only on the Plasma desktop: gamescope doesn't show notifications or a
|
||||
# tray, so an update found in gaming mode waits for the next desktop login.
|
||||
return subprocess.run(["pgrep", "-u", str(os.getuid()), "-x", "plasmashell"],
|
||||
stdout=subprocess.DEVNULL).returncode == 0
|
||||
# Only on the Plasma or GNOME desktop: gamescope doesn't show notifications
|
||||
# or a tray, so an update found in gaming mode waits for the next desktop login.
|
||||
return any(subprocess.run(["pgrep", "-u", str(os.getuid()), "-x", shell],
|
||||
stdout=subprocess.DEVNULL).returncode == 0
|
||||
for shell in ("plasmashell", "gnome-shell"))
|
||||
|
||||
|
||||
def terminal():
|
||||
# The command prefix that runs a program in a terminal window.
|
||||
for program, prefix in (("konsole", ["konsole", "-e"]), ("ptyxis", ["ptyxis", "--"]),
|
||||
("kgx", ["kgx", "-e"]), ("gnome-terminal", ["gnome-terminal", "--"])):
|
||||
if shutil.which(program):
|
||||
return prefix
|
||||
return ["xterm", "-e"]
|
||||
|
||||
|
||||
def main():
|
||||
@@ -91,8 +102,8 @@ def main():
|
||||
# ends the reminder. In its own unit: this one's processes are
|
||||
# stopped when the check exits.
|
||||
if state("frontend") == "terminal":
|
||||
cmd = ["konsole", "-e", RUN_TERMINAL] if os.access(RUN_TERMINAL, os.X_OK) else \
|
||||
["konsole", "-e", "bash", "-c",
|
||||
cmd = [*terminal(), RUN_TERMINAL] if os.access(RUN_TERMINAL, os.X_OK) else \
|
||||
[*terminal(), "bash", "-c",
|
||||
f"set -o pipefail; curl -fsSL --max-time 30 {RELEASE}/steamify.sh | bash; read -rp 'Press Enter to close. ' _"]
|
||||
else:
|
||||
cmd = [RUN_APP] if os.access(RUN_APP, os.X_OK) else \
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// Steamify Vapor (Steamify GNOME theme). Its stylesheet.css, which GNOME Shell loads
|
||||
// by itself, is the SteamOS look. This code: GNOME opens the overview after login;
|
||||
// Ubuntu starts on the desktop. So does this: the overview stays closed while the
|
||||
// shell starts up, and is available again right after.
|
||||
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
|
||||
import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js';
|
||||
|
||||
export default class SteamifyDesktopStart extends Extension {
|
||||
enable() {
|
||||
if (!Main.layoutManager._startingUp)
|
||||
return;
|
||||
this._hadOverview = Main.sessionMode.hasOverview;
|
||||
Main.sessionMode.hasOverview = false;
|
||||
this._startupId = Main.layoutManager.connect('startup-complete', () => {
|
||||
Main.sessionMode.hasOverview = this._hadOverview;
|
||||
Main.overview.hide();
|
||||
});
|
||||
}
|
||||
|
||||
disable() {
|
||||
if (this._startupId) {
|
||||
Main.layoutManager.disconnect(this._startupId);
|
||||
this._startupId = null;
|
||||
}
|
||||
if (this._hadOverview !== undefined)
|
||||
Main.sessionMode.hasOverview = this._hadOverview;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"uuid": "steamify-vapor@steamify.github.io",
|
||||
"name": "Steamify Vapor",
|
||||
"description": "The SteamOS (Vapor) look for the shell, and log in to the desktop, not the overview.",
|
||||
"shell-version": [
|
||||
"45",
|
||||
"46",
|
||||
"47",
|
||||
"48",
|
||||
"49",
|
||||
"50",
|
||||
"51"
|
||||
]
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
[Unit]
|
||||
Description=Steamify CachyOS: boot into the desktop instead of gaming mode
|
||||
Before=display-manager.service sddm.service plasmalogin.service
|
||||
Before=display-manager.service sddm.service plasmalogin.service gdm.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/lib/steamos/steam-set-session plasma.desktop
|
||||
ExecStart=/usr/lib/steamos/steam-set-session @DESKTOP_SESSION@
|
||||
ExecStart=/bin/sh -c '[ -x @SESSION_SYNC@ ] && exec @SESSION_SYNC@ || true'
|
||||
|
||||
[Install]
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ VERSION=2.12.0
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
for lib in common state packages login-manager single-user steam-desktop steam-machine fremont-poweroff vram-booster hdmi-refresh nvidia gamescope-nvidia controllers cec boot-session vapor-theme steamos-extras bios desktop-shortcut wizard-shortcut steam-game update-notifier first-login menu backend; do
|
||||
for lib in common state desktop packages login-manager single-user steam-desktop steam-machine fremont-poweroff vram-booster hdmi-refresh nvidia gamescope-nvidia controllers cec boot-session vapor-theme gnome-theme steamos-extras bios desktop-shortcut wizard-shortcut steam-game update-notifier first-login menu backend; do
|
||||
# shellcheck source=/dev/null
|
||||
source "$SCRIPT_DIR/lib/$lib.sh"
|
||||
done
|
||||
|
||||
Reference in new issue
Block a user