feat(deck): Add service to return to gaming mode

Fixes users not being to switch to gaming mode when they have desktop autologin toggled
and should allow users to start gaming mode immediately after Steam has been updated
instead of having to reboot after setup (although this should be done regardless)
This commit is contained in:
RJ Trujillo 2023-09-17 06:41:12 -06:00
parent 91b0c86063
commit 64ef129f7c
3 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
source /etc/default/bazzite
USER=$(id -nu 1000)
# SteamOS autologin SDDM config
AUTOLOGIN_CONF='/etc/sddm.conf.d/zz-steamos-autologin.conf'
# Configure autologin if Steam has been updated
if [[ -f /var/home/$USER/.local/share/Steam/ubuntu12_32/steamui.so ]]; then
{
echo "[Autologin]"
echo "Session=gamescope-session.desktop"
} > "$AUTOLOGIN_CONF"
fi
if [[ $BASE_IMAGE_NAME = "kinoite" ]]; then
sudo -Eu $USER qdbus org.kde.Shutdown /Shutdown org.kde.Shutdown.logout
elif [[ $BASE_IMAGE_NAME = "silverblue" ]]; then
sudo -Eu $USER gnome-session-quit --logout --no-prompt
fi

View File

@ -0,0 +1,8 @@
polkit.addRule(function(action, subject) {
if (subject.isInGroup("wheel") &&
action.id == "org.freedesktop.systemd1.manage-units" &&
action.lookup("unit") == "return-to-gamemode.service")
{
return polkit.Result.YES;
}
})

View File

@ -0,0 +1,6 @@
[Unit]
Description=Return to Gaming Mode
[Service]
Type=oneshot
ExecStart=/usr/bin/return-to-gamemode