[presets] simplify steam module

This commit is contained in:
Philip Mueller 2023-07-17 12:26:17 +02:00
parent a84fec343a
commit 5209080fa4
14 changed files with 12 additions and 336 deletions

View File

@ -1 +0,0 @@
../steam

View File

@ -1,38 +1,18 @@
packages = ["steam", "gamescope-session-git", "gamescope-plus", "wget", "vulkan-icd-loader", "lib32-vulkan-icd-loader", "vulkan-intel", "lib32-vulkan-intel", "vulkan-radeon", "lib32-vulkan-radeon", "ttf-liberation", "adobe-source-sans-pro-fonts", "adobe-source-han-sans-jp-fonts", "adobe-source-han-sans-kr-fonts", "adobe-source-han-sans-cn-fonts", "mangohud", "lib32-mangohud", "qt5-virtualkeyboard"]
packages = ["steam", "steam-deckify", "gamescope-session-git", "gamescope-plus", "wget", "vulkan-icd-loader", "lib32-vulkan-icd-loader", "vulkan-intel", "lib32-vulkan-intel", "vulkan-radeon", "lib32-vulkan-radeon", "ttf-liberation", "adobe-source-sans-pro-fonts", "adobe-source-han-sans-jp-fonts", "adobe-source-han-sans-kr-fonts", "adobe-source-han-sans-cn-fonts", "mangohud", "lib32-mangohud", "qt5-virtualkeyboard"]
script = """
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
mkdir -p /etc/sddm.conf.d
echo "# Created by Manjaro ALMA" > /etc/sddm.conf.d/manjaro.conf
echo "[General]" >> /etc/sddm.conf.d/manjaro.conf
echo "DisplayServer=wayland" >> /etc/sddm.conf.d/manjaro.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 "InputMethod=qtvirtualkeyboard" >> /etc/sddm.conf.d/virtualkbd.conf
install -Dm755 /shared_dirs/steam/steamos-gamemode.desktop -t /home/${ALMA_USER}/Desktop
install -Dm644 /shared_dirs/steam/org.manjaro.host.policy -t /usr/share/polkit-1/actions
install -Dm644 /shared_dirs/steam/org.manjaro.priv.write.policy -t /usr/share/polkit-1/actions
install -Dm644 /shared_dirs/steam/org.manjaro.session.select.policy -t /usr/share/polkit-1/actions
install -Dm644 /shared_dirs/steam/steamdeck-gaming-return.svg -t /usr/share/icons/hicolor/64x64/apps
install -Dm755 /shared_dirs/steam/steamos-priv-write -t /usr/bin/steamos-polkit-helpers
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-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
echo "# Created by Manjaro ALMA" > /etc/sddm.conf.d/zz-steam-deckify.conf
echo "[General]" >> /etc/sddm.conf.d/zz-steam-deckify.conf
echo "DisplayServer=wayland" >> /etc/sddm.conf.d/zz-steam-deckify.conf
echo "[Autologin]" >> /etc/sddm.conf.d/zz-steam-deckify.conf
echo "Relogin=true" >> /etc/sddm.conf.d/zz-steam-deckify.conf
echo "Session=gamescope-session.desktop" >> /etc/sddm.conf.d/zz-steam-deckify.conf
echo "User=${ALMA_USER}" >> /etc/sddm.conf.d/zz-steam-deckify.conf
echo "[X11]" >> /etc/sddm.conf.d/zz-steam-deckify.conf
echo "# Janky workaround for wayland sessions not stopping in sddm, kills" >> /etc/sddm.conf.d/zz-steam-deckify.conf
echo "# all active sddm-helper sessions on teardown" >> /etc/sddm.conf.d/zz-steam-deckify.conf
echo "DisplayStopCommand=/usr/bin/gamescope-wayland-teardown-workaround" >> /etc/sddm.conf.d/zz-steam-deckify.conf
chown -R ${ALMA_USER}:${ALMA_USER} /home/${ALMA_USER}
"""
environment_variables = ["ALMA_USER"]
shared_directories = ["steam"]

View File

@ -1,12 +0,0 @@
#!/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

View File

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<vendor>Manjaro</vendor>
<vendor_url>https://manjaro.org</vendor_url>
<action id="org.manjaro.policykit.steamos.pkexec.run-set-hostname">
<description>Set the hostname</description>
<icon_name>package-x-generic</icon_name>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/steamos-polkit-helpers/steamos-set-hostname</annotate>
</action>
<action id="org.manjaro.policykit.steamos.pkexec.run-set-timezone">
<description>Set the timezone</description>
<icon_name>package-x-generic</icon_name>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/steamos-polkit-helpers/steamos-set-timezone</annotate>
</action>
</policyconfig>

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<vendor>Manjaro</vendor>
<vendor_url>https://manjaro.org</vendor_url>
<action id="org.chimeraos.policykit.steamos.pkexec.run-steamos-polkit-helpers-steamos-priv-write">
<description>Helper to write to a set of device nodes</description>
<icon_name>package-x-generic</icon_name>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/steamos-polkit-helpers/steamos-priv-write</annotate>
</action>
</policyconfig>

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<vendor>Manjaro Linux</vendor>
<vendor_url>https://manjaro.org</vendor_url>
<action id="org.manjaro.policykit.steamos.pkexec.run-session-select">
<description>Helper to switch sessions</description>
<icon_name>package-x-generic</icon_name>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/lib/os-session-select</annotate>
</action>
</policyconfig>

View File

@ -1,84 +0,0 @@
#!/bin/bash
set -e
die() { echo >&2 "!! $*"; exit 1; }
# 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"
# For sanity this shipped file must be present, to ensure we're still on a normal-looking setup.
CHECK_FILE="/etc/sddm.conf.d/manjaro.conf"
session="${1:-gamescope}"
session_launcher=""
create_sentinel=""
session_uses_x11=""
case "$session" in
plasma-wayland-persistent)
session_launcher="plasmawayland.desktop"
;;
plasma-persistent)
session_launcher="plasma.desktop"
session_uses_x11=1
;;
plasma)
session_launcher="plasma-steamos-oneshot.desktop"
create_sentinel=1
session_uses_x11=1
;;
gamescope)
session_launcher="gamescope-session.desktop"
;;
*)
echo >&2 "!! Unrecognized session '$session'"
exit 1
;;
esac
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
if [[ $EUID != 0 ]]; then
exec pkexec "$(realpath $0)" "$session" --sentinel-created
exit 1
fi
{
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"
systemctl reset-failed sddm
systemctl restart sddm
echo "Restarted SDDM"

View File

@ -1,7 +0,0 @@
[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

View File

@ -1,46 +0,0 @@
#!/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

View File

@ -1,10 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" version="1.1">
<circle style="opacity:0.2" cx="25" cy="33" r="14"/>
<path style="opacity:0.2" d="m 25,5 v 9.8 A 18.2,18.2 0 0 1 43.2,33 18.2,18.2 0 0 1 25,51.2 V 61 C 40.464021,61 53,48.464022 53,33 53,17.535978 40.464021,5 25,5 Z"/>
<path style="fill:#e4e4e4" d="m 25,4 v 9.8 A 18.2,18.2 0 0 1 43.2,32 18.2,18.2 0 0 1 25,50.2 V 60 C 40.464021,60 53,47.464022 53,32 53,16.535978 40.464021,4 25,4 Z"/>
<circle style="fill:#556af7" cx="25" cy="32" r="14"/>
<path style="fill:#ffffff;opacity:0.2" d="M 25 4 L 25 5 C 40.296382 5 52.718597 17.267528 52.986328 32.5 C 52.989262 32.333062 53 32.167639 53 32 C 53 16.535978 40.464021 4 25 4 z M 43.179688 32.248047 A 18.2 18.2 0 0 1 25 50.199219 L 25 51.199219 A 18.2 18.2 0 0 0 43.199219 33 A 18.2 18.2 0 0 0 43.179688 32.248047 z"/>
<path style="fill:#ffffff;opacity:0.1" d="M 25 18 A 14 14 0 0 0 11 32 A 14 14 0 0 0 11.035156 32.5 A 14 14 0 0 1 25 19 A 14 14 0 0 1 38.980469 32.279297 A 14 14 0 0 0 39 32 A 14 14 0 0 0 25 18 z"/>
<path style="opacity:0.2;fill:none;stroke:#000000;stroke-width:3;stroke-linecap:round;stroke-linejoin:round" d="m 16.5,32.5 h 17 m -11,-6 -6,6 6,6"/>
<path style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round" d="m 16.5,31.5 h 17 m -11,-6 -6,6 6,6"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1,7 +0,0 @@
[Desktop Entry]
Name=Return to Gaming Mode
Exec=qdbus org.kde.Shutdown /Shutdown org.kde.Shutdown.logout
Icon=steamdeck-gaming-return
Terminal=false
Type=Application
StartupNotify=false

View File

@ -1,40 +0,0 @@
#!/bin/bash
set -eu
if [[ $EUID -ne 0 ]];
then
exec pkexec --disable-internal-agent "$0" "$@"
fi
WRITE_PATH="$1"
WRITE_VALUE="$2"
function CommitWrite()
{
echo "commit: $WRITE_VALUE -> $WRITE_PATH" | systemd-cat -t p-steamos-priv-write -p warning
chmod a+w "$WRITE_PATH"
echo "$WRITE_VALUE" > "$WRITE_PATH"
exit 0
}
function DeclineWrite()
{
echo "decline: $WRITE_VALUE -> $WRITE_PATH" | systemd-cat -t p-steamos-priv-write -p err
exit 1
}
echo "checking: $WRITE_PATH" | systemd-cat -t p-steamos-priv-write -p warning
if [[ "$WRITE_PATH" == /sys/class/backlight/*/brightness ]]; then
CommitWrite
fi
if [[ "$WRITE_PATH" == /sys/devices/*/*/*/*/hwmon/hwmon*/led_brightness ]]; then
CommitWrite
fi
if [[ "$WRITE_PATH" == /sys/devices/*/*/*/*/hwmon/hwmon*/content_adaptive_brightness ]]; then
CommitWrite
fi
DeclineWrite

View File

@ -1,10 +0,0 @@
#!/bin/bash
set -eu
if [[ $EUID -ne 0 ]];
then
exec pkexec --disable-internal-agent "$0" "$@"
fi
hostnamectl set-hostname "$1"

View File

@ -1,11 +0,0 @@
#!/bin/bash
set -eu
if [[ $EUID -ne 0 ]];
then
exec pkexec --disable-internal-agent "$0" "$@"
fi
timedatectl set-timezone "$1"