mirror of
https://github.com/philmmanjaro/alma.git
synced 2025-07-25 22:49:28 +02:00
[presets] update steam
This commit is contained in:
parent
e4c9ded69f
commit
b3d6b09f61
@ -5,10 +5,17 @@ set -eux
|
|||||||
wget -v https://gitlab.com/evlaV/jupiter_steam-jupiter-stable-PKGBUILD/-/raw/5cd60f3cd66527a95f93e6fefd9371fd659a5aea/steam_jupiter_stable_bootstrapped_20230316.1.tar.xz -O /usr/lib/steam/bootstraplinux_ubuntu12_32.tar.xz
|
wget -v https://gitlab.com/evlaV/jupiter_steam-jupiter-stable-PKGBUILD/-/raw/5cd60f3cd66527a95f93e6fefd9371fd659a5aea/steam_jupiter_stable_bootstrapped_20230316.1.tar.xz -O /usr/lib/steam/bootstraplinux_ubuntu12_32.tar.xz
|
||||||
|
|
||||||
mkdir -p /etc/sddm.conf.d
|
mkdir -p /etc/sddm.conf.d
|
||||||
echo "# Created by Manjaro ALMA" > /etc/sddm.conf.d/99-autologin.conf
|
echo "# Created by Manjaro ALMA" > /etc/sddm.conf.d/manjaro.conf
|
||||||
echo "[Autologin]" >> /etc/sddm.conf.d/99-autologin.conf
|
echo "[General]" >> /etc/sddm.conf.d/manjaro.conf
|
||||||
echo "User=${ALMA_USER}" >> /etc/sddm.conf.d/99-autologin.conf
|
echo "DisplayServer=wayland" >> /etc/sddm.conf.d/manjaro.conf
|
||||||
echo "Session=gamescope-session.desktop" >> /etc/sddm.conf.d/99-autologin.conf
|
echo "[Autologin]" >> /etc/sddm.conf.d/manjaro.conf
|
||||||
|
echo "Relogin=true" >> /etc/sddm.conf.d/manjaro.conf
|
||||||
|
echo "Session=gamescope-session.desktop" >> /etc/sddm.conf.d/manjaro.conf
|
||||||
|
echo "User=$ALMA_USER" >> /etc/sddm.conf.d/manjaro.conf
|
||||||
|
echo "[X11]" >> /etc/sddm.conf.d/manjaro.conf
|
||||||
|
echo "# Janky workaround for wayland sessions not stopping in sddm, kills" >> /etc/sddm.conf.d/manjaro.conf
|
||||||
|
echo "# all active sddm-helper sessions on teardown" >> /etc/sddm.conf.d/manjaro.conf
|
||||||
|
echo "DisplayStopCommand=/usr/bin/gamescope-wayland-teardown-workaround" >> /etc/sddm.conf.d/manjaro.conf
|
||||||
|
|
||||||
echo "[General]" > /etc/sddm.conf.d/virtualkbd.conf
|
echo "[General]" > /etc/sddm.conf.d/virtualkbd.conf
|
||||||
echo "InputMethod=qtvirtualkeyboard" >> /etc/sddm.conf.d/virtualkbd.conf
|
echo "InputMethod=qtvirtualkeyboard" >> /etc/sddm.conf.d/virtualkbd.conf
|
||||||
@ -22,6 +29,9 @@ install -Dm755 /shared_dirs/steam/steamos-priv-write -t /usr/bin/steamos-polkit-
|
|||||||
install -Dm755 /shared_dirs/steam/os-session-select -t /usr/lib
|
install -Dm755 /shared_dirs/steam/os-session-select -t /usr/lib
|
||||||
install -Dm755 /shared_dirs/steam/steamos-set-hostname -t /usr/bin/steamos-polkit-helpers
|
install -Dm755 /shared_dirs/steam/steamos-set-hostname -t /usr/bin/steamos-polkit-helpers
|
||||||
install -Dm755 /shared_dirs/steam/steamos-set-timezone -t /usr/bin/steamos-polkit-helpers
|
install -Dm755 /shared_dirs/steam/steamos-set-timezone -t /usr/bin/steamos-polkit-helpers
|
||||||
|
install -Dm755 /shared_dirs/steam/gamescope-wayland-teardown-workaround -t /usr/bin
|
||||||
|
install -Dm755 /shared_dirs/steam/startplasma-steamos-oneshot -t /usr/bin
|
||||||
|
install -Dm755 /shared_dirs/steam/plasma-steamos-oneshot.desktop -t /usr/share/xsessions
|
||||||
chown -R ${ALMA_USER}:${ALMA_USER} /home/${ALMA_USER}
|
chown -R ${ALMA_USER}:${ALMA_USER} /home/${ALMA_USER}
|
||||||
"""
|
"""
|
||||||
environment_variables = ["ALMA_USER"]
|
environment_variables = ["ALMA_USER"]
|
||||||
|
12
presets/steam/gamescope-wayland-teardown-workaround
Executable file
12
presets/steam/gamescope-wayland-teardown-workaround
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
TARGETS=('/bin/bash /usr/bin/gamescope-session'
|
||||||
|
'/usr/bin/kwin_x11')
|
||||||
|
|
||||||
|
for target in "${TARGETS[@]}"; do
|
||||||
|
for processtree in $(pgrep -xf "$target" || true); do
|
||||||
|
kill -- "-$processtree"
|
||||||
|
done
|
||||||
|
done
|
@ -1,67 +1,40 @@
|
|||||||
#! /usr/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
die() { echo >&2 "!! $*"; exit 1; }
|
die() { echo >&2 "!! $*"; exit 1; }
|
||||||
|
|
||||||
CONF_FILE="/etc/sddm.conf.d/99-autologin.conf"
|
# FIXME Purge old files and use this one
|
||||||
|
|
||||||
|
# File this script will modify, in addition to (potentially) the per-user sentinel file
|
||||||
|
CONF_FILE="/etc/sddm.conf.d/zz-steamos-autologin.conf"
|
||||||
|
|
||||||
SENTINEL_FILE="steamos-session-select"
|
SENTINEL_FILE="steamos-session-select"
|
||||||
|
|
||||||
# For sanity this shipped file must be present, to ensure we're still on a normal-looking setup.
|
# For sanity this shipped file must be present, to ensure we're still on a normal-looking setup.
|
||||||
CHECK_FILE="/etc/sddm.conf.d/99-autologin.conf"
|
CHECK_FILE="/etc/sddm.conf.d/manjaro.conf"
|
||||||
|
|
||||||
session="${1:-gamescope}"
|
session="${1:-gamescope}"
|
||||||
session_type="wayland"
|
|
||||||
|
|
||||||
session_launcher="gamescope-session"
|
session_launcher=""
|
||||||
create_sentinel=""
|
create_sentinel=""
|
||||||
|
session_uses_x11=""
|
||||||
|
|
||||||
if [[ "$2" == "--sentinel-created" ]]; then
|
|
||||||
SENTINEL_CREATED=1
|
|
||||||
session_type="wayland"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Update config sentinel
|
|
||||||
if [[ -z $SENTINEL_CREATED ]]; then
|
|
||||||
[[ $EUID == 0 ]] && die "Running $0 as root is not allowed"
|
|
||||||
|
|
||||||
[[ -n ${HOME+x} ]] || die "No \$HOME variable"
|
|
||||||
config_dir="${XDG_CONF_DIR:-"$HOME/.config"}"
|
|
||||||
session_type=$(
|
|
||||||
cd "$HOME"
|
|
||||||
mkdir -p "$config_dir"
|
|
||||||
cd "$config_dir"
|
|
||||||
if [[ -f "steamos-session-type" ]]; then
|
|
||||||
cp steamos-session-type "$SENTINEL_FILE"
|
|
||||||
else
|
|
||||||
echo "wayland" > "$SENTINEL_FILE"
|
|
||||||
fi
|
|
||||||
cat "$SENTINEL_FILE"
|
|
||||||
)
|
|
||||||
|
|
||||||
# clear steam game desktop shortcut clutter
|
|
||||||
DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
|
|
||||||
grep --files-with-matches "Exec=steam steam://rungameid/" ${DATA_HOME}/applications/* | tr '\n' '\0' | xargs -0 -I {} rm {} || true
|
|
||||||
|
|
||||||
# If we were executed as a session user and then re-execute as root below, we don't want to set root's sentinel too
|
|
||||||
export SENTINEL_CREATED=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# We use "plasma" as "desktop" to hook up to SteamOS's scripts
|
|
||||||
case "$session" in
|
case "$session" in
|
||||||
plasma-wayland-persistent)
|
plasma-wayland-persistent)
|
||||||
session_launcher="plasma"
|
session_launcher="plasmawayland.desktop"
|
||||||
;;
|
;;
|
||||||
plasma-x11-persistent)
|
plasma-persistent)
|
||||||
session_launcher="plasma"
|
session_launcher="plasma.desktop"
|
||||||
|
session_uses_x11=1
|
||||||
;;
|
;;
|
||||||
desktop|plasma)
|
plasma)
|
||||||
session_launcher="plasma"
|
session_launcher="plasma-steamos-oneshot.desktop"
|
||||||
create_sentinel=1
|
create_sentinel=1
|
||||||
|
session_uses_x11=1
|
||||||
;;
|
;;
|
||||||
gamescope)
|
gamescope)
|
||||||
session_launcher="gamescope-session"
|
session_launcher="gamescope-session.desktop"
|
||||||
create_sentinel=1
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo >&2 "!! Unrecognized session '$session'"
|
echo >&2 "!! Unrecognized session '$session'"
|
||||||
@ -69,21 +42,43 @@ case "$session" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo "Updated user selected session to $session_launcher"
|
if [[ "$2" == "--sentinel-created" ]]; then
|
||||||
|
SENTINEL_CREATED=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update config sentinel
|
||||||
|
if [[ -z $SENTINEL_CREATED ]]; then
|
||||||
|
[[ -n ${HOME+x} ]] || die "No \$HOME variable"
|
||||||
|
config_dir="${XDG_CONF_DIR:-"$HOME/.config"}"
|
||||||
|
(
|
||||||
|
cd "$HOME"
|
||||||
|
mkdir -p "$config_dir"
|
||||||
|
cd "$config_dir"
|
||||||
|
echo "$session_launcher" > "$SENTINEL_FILE"
|
||||||
|
)
|
||||||
|
|
||||||
|
# If we were executed as a session user and then re-execute as root below, we don't want to set root's sentinel too
|
||||||
|
export SENTINEL_CREATED=1
|
||||||
|
echo "Updated user selected session to $session_launcher"
|
||||||
|
fi
|
||||||
|
|
||||||
# Become root
|
# Become root
|
||||||
if [[ $EUID != 0 ]]; then
|
if [[ $EUID != 0 ]]; then
|
||||||
exec pkexec "$(realpath $0)" "$session" --sentinel-created
|
exec pkexec "$(realpath $0)" "$session" --sentinel-created
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -i "s/.*Session=.*/Session=$session_launcher/g" $CONF_FILE
|
{
|
||||||
|
if [[ -n $session_uses_x11 ]]; then
|
||||||
|
# Default is Wayland
|
||||||
|
echo "[General]"
|
||||||
|
echo "DisplayServer=X11"
|
||||||
|
fi
|
||||||
|
echo "[Autologin]"
|
||||||
|
echo "Session=$session_launcher"
|
||||||
|
} > "$CONF_FILE"
|
||||||
|
|
||||||
echo "Updated system autologin session to $session_launcher"
|
echo "Updated system autologin session to $session_launcher"
|
||||||
systemctl reset-failed sddm
|
systemctl reset-failed sddm
|
||||||
systemctl restart sddm
|
systemctl restart sddm
|
||||||
echo "Restarted SDDM"
|
echo "Restarted SDDM"
|
||||||
|
|
||||||
if [[ $session == plasma ]] || [[ $session == desktop ]]; then
|
|
||||||
echo "Ending gamescope session"
|
|
||||||
pkill -f gamescope
|
|
||||||
fi
|
|
||||||
|
7
presets/steam/plasma-steamos-oneshot.desktop
Normal file
7
presets/steam/plasma-steamos-oneshot.desktop
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Type=XSession
|
||||||
|
Exec=/usr/bin/startplasma-steamos-oneshot
|
||||||
|
TryExec=/usr/bin/startplasma-steamos-oneshot
|
||||||
|
DesktopNames=KDE (One-Time Launch)
|
||||||
|
Name=Plasma (One-Time Launch)
|
||||||
|
Comment=Plasma by KDE - One Time Launch Redirect for SteamOS Sessions
|
46
presets/steam/startplasma-steamos-oneshot
Executable file
46
presets/steam/startplasma-steamos-oneshot
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
die() { echo >&2 "!! $*"; exit 1; }
|
||||||
|
|
||||||
|
SENTINEL_FILE="steamos-session-select"
|
||||||
|
SENTINEL_VALUE="plasma-steamos-oneshot.desktop"
|
||||||
|
|
||||||
|
# If we proceed, execute this
|
||||||
|
CHAINED_SESSION="/usr/bin/startplasma-x11"
|
||||||
|
# If we decide the sentinel is consumed, execute this command instead and fail
|
||||||
|
RESTORE_SESSION=(steamos-session-select) # No arguments restores the session
|
||||||
|
|
||||||
|
# Find or check config sentinel
|
||||||
|
check_sentinel()
|
||||||
|
{
|
||||||
|
if [[ -z ${HOME+x} ]]; then
|
||||||
|
echo >&2 "$0: No \$HOME variable!"
|
||||||
|
# Rather than break we'll just launch plasma and hope for the best?
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
local config_dir="${XDG_CONF_DIR:-"$HOME/.config"}"
|
||||||
|
(
|
||||||
|
cd "$HOME"
|
||||||
|
cd "$config_dir"
|
||||||
|
sentinel_value="$(cat "$SENTINEL_FILE")"
|
||||||
|
[[ $sentinel_value = "$SENTINEL_VALUE" ]] || return 1
|
||||||
|
rm "$SENTINEL_FILE"
|
||||||
|
) || return 1 # If we couldn't read the value or it wasn't what we wanted
|
||||||
|
|
||||||
|
# Found value and removed it, we're good to continue
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if check_sentinel; then
|
||||||
|
# We found and consumed the oneshot sentinel, proceed to launch plasma
|
||||||
|
echo >&2 "$0: Found and removed sentinel file for one-shot plasma, proceeding to launch"
|
||||||
|
exec "$CHAINED_SESSION"
|
||||||
|
else
|
||||||
|
echo >&2 "$0: Sentinel value not found, executing session-select to restore session"
|
||||||
|
"${RESTORE_SESSION[@]}" || echo >&2 "$0: !! Failed to restore previous session, executing chained session"
|
||||||
|
# Session restore should've stopped us, if it is broken at least let plasma continue to open
|
||||||
|
exec "$CHAINED_SESSION"
|
||||||
|
fi
|
@ -1,20 +1,7 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Comment[en_US]=
|
Name=Return to Gaming Mode
|
||||||
Comment=
|
Exec=qdbus org.kde.Shutdown /Shutdown org.kde.Shutdown.logout
|
||||||
Exec=steamos-session-select
|
|
||||||
GenericName[en_US]=
|
|
||||||
GenericName=
|
|
||||||
Icon=steamdeck-gaming-return
|
Icon=steamdeck-gaming-return
|
||||||
MimeType=
|
|
||||||
Name[en_US]=Return to Gaming mode
|
|
||||||
Name=Return to Gaming mode
|
|
||||||
Name[zh_CN]=返回游戏模式
|
|
||||||
Path=/usr/bin/
|
|
||||||
StartupNotify=true
|
|
||||||
Terminal=false
|
Terminal=false
|
||||||
TerminalOptions=
|
|
||||||
Type=Application
|
Type=Application
|
||||||
X-DBUS-ServiceName=
|
StartupNotify=false
|
||||||
X-DBUS-StartupType=
|
|
||||||
X-KDE-SubstituteUID=false
|
|
||||||
X-KDE-Username=
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user