mirror of
https://github.com/philmmanjaro/alma.git
synced 2025-07-26 06:59:28 +02:00
[presets] update steam module
This commit is contained in:
parent
391c5d0cc1
commit
5b03b592fe
1
presets/plasma-steam/steam
Symbolic link
1
presets/plasma-steam/steam
Symbolic link
@ -0,0 +1 @@
|
||||
../steam
|
1
presets/rog-ally-plasma/steam
Symbolic link
1
presets/rog-ally-plasma/steam
Symbolic link
@ -0,0 +1 @@
|
||||
../steam
|
@ -9,5 +9,16 @@ echo "# Created by Manjaro ALMA" > /etc/sddm.conf.d/99-autologin.conf
|
||||
echo "[Autologin]" >> /etc/sddm.conf.d/99-autologin.conf
|
||||
echo "User=${ALMA_USER}" >> /etc/sddm.conf.d/99-autologin.conf
|
||||
echo "Session=gamescope-session.desktop" >> /etc/sddm.conf.d/99-autologin.conf
|
||||
|
||||
install -Dm644 /shared_dirs/steamos-gamemode.desktop -t /etc/.skel/Desktop
|
||||
install -Dm644 /shared_dirs/org.manjaro.host.policy -t /usr/share/polkit-1/actions
|
||||
install -Dm644 /shared_dirs/org.manjaro.priv.write.policy -t /usr/share/polkit-1/actions
|
||||
install -Dm644 /shared_dirs/org.manjaro.session.select.policy -t /usr/share/polkit-1/actions
|
||||
install -Dm644 /shared_dirs/steamdeck-gaming-return.svg -t /usr/share/icons/hicolor/64x64/
|
||||
install -Dm755 /shared_dirs/steamos-priv-write -t /usr/bin/steamos-polkit-helpers
|
||||
install -Dm755 /shared_dirs/steamos-session-select -t /usr/bin
|
||||
install -Dm755 /shared_dirs/steamos-set-hostname -t /usr/bin/steamos-polkit-helpers
|
||||
install -Dm755 /shared_dirs/steamos-set-timezone -t /usr/bin/steamos-polkit-helpers
|
||||
"""
|
||||
environment_variables = ["ALMA_USER"]
|
||||
shared_directories = ["steam"]
|
||||
|
32
presets/steam/org.manjaro.host.policy
Normal file
32
presets/steam/org.manjaro.host.policy
Normal file
@ -0,0 +1,32 @@
|
||||
<?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>
|
22
presets/steam/org.manjaro.priv.write.policy
Normal file
22
presets/steam/org.manjaro.priv.write.policy
Normal file
@ -0,0 +1,22 @@
|
||||
<?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>
|
||||
|
22
presets/steam/org.manjaro.session.select.policy
Normal file
22
presets/steam/org.manjaro.session.select.policy
Normal file
@ -0,0 +1,22 @@
|
||||
<?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/bin/steamos-session-select</annotate>
|
||||
</action>
|
||||
|
||||
</policyconfig>
|
||||
|
10
presets/steam/steamdeck-gaming-return.svg
Normal file
10
presets/steam/steamdeck-gaming-return.svg
Normal file
@ -0,0 +1,10 @@
|
||||
<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>
|
After Width: | Height: | Size: 1.3 KiB |
20
presets/steam/steamos-gamemode.desktop
Executable file
20
presets/steam/steamos-gamemode.desktop
Executable file
@ -0,0 +1,20 @@
|
||||
[Desktop Entry]
|
||||
Comment[en_US]=
|
||||
Comment=
|
||||
Exec=steamos-session-select
|
||||
GenericName[en_US]=
|
||||
GenericName=
|
||||
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
|
||||
TerminalOptions=
|
||||
Type=Application
|
||||
X-DBUS-ServiceName=
|
||||
X-DBUS-StartupType=
|
||||
X-KDE-SubstituteUID=false
|
||||
X-KDE-Username=
|
40
presets/steam/steamos-priv-write
Executable file
40
presets/steam/steamos-priv-write
Executable file
@ -0,0 +1,40 @@
|
||||
#!/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
|
89
presets/steam/steamos-session-select
Executable file
89
presets/steam/steamos-session-select
Executable file
@ -0,0 +1,89 @@
|
||||
#! /usr/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
die() { echo >&2 "!! $*"; exit 1; }
|
||||
|
||||
CONF_FILE="/etc/sddm.conf.d/99-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/99-autologin.conf"
|
||||
|
||||
session="${1:-gamescope}"
|
||||
session_type="wayland"
|
||||
|
||||
session_launcher="gamescope-session"
|
||||
create_sentinel=""
|
||||
|
||||
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
|
||||
plasma-wayland-persistent)
|
||||
session_launcher="plasma"
|
||||
;;
|
||||
plasma-x11-persistent)
|
||||
session_launcher="plasma"
|
||||
;;
|
||||
desktop|plasma)
|
||||
session_launcher="plasma"
|
||||
create_sentinel=1
|
||||
;;
|
||||
gamescope)
|
||||
session_launcher="gamescope-session"
|
||||
create_sentinel=1
|
||||
;;
|
||||
*)
|
||||
echo >&2 "!! Unrecognized session '$session'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Updated user selected session to $session_launcher"
|
||||
|
||||
# Become root
|
||||
if [[ $EUID != 0 ]]; then
|
||||
exec pkexec "$(realpath $0)" "$session" --sentinel-created
|
||||
fi
|
||||
|
||||
sed -i "s/.*Session=.*/Session=$session_launcher/g" $CONF_FILE
|
||||
|
||||
echo "Updated system autologin session to $session_launcher"
|
||||
systemctl reset-failed sddm
|
||||
systemctl restart sddm
|
||||
echo "Restarted SDDM"
|
||||
|
||||
if [[ $session == plasma ]] || [[ $session == desktop ]]; then
|
||||
echo "Ending gamescope session"
|
||||
pkill -f gamescope
|
||||
fi
|
10
presets/steam/steamos-set-hostname
Executable file
10
presets/steam/steamos-set-hostname
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
if [[ $EUID -ne 0 ]];
|
||||
then
|
||||
exec pkexec --disable-internal-agent "$0" "$@"
|
||||
fi
|
||||
|
||||
hostnamectl set-hostname "$1"
|
11
presets/steam/steamos-set-timezone
Executable file
11
presets/steam/steamos-set-timezone
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
if [[ $EUID -ne 0 ]];
|
||||
then
|
||||
exec pkexec --disable-internal-agent "$0" "$@"
|
||||
fi
|
||||
|
||||
timedatectl set-timezone "$1"
|
||||
|
Loading…
x
Reference in New Issue
Block a user