Merge pull request #313 from ublue-os/return-to-gamemode

feat(deck): Add service to return to gaming mode
This commit is contained in:
RJ Trujillo 2023-09-18 11:38:37 -06:00 committed by GitHub
commit 70f776c6fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 7 deletions

View File

@ -377,6 +377,9 @@ RUN rm /usr/share/applications/wine*.desktop && \
mkdir -p "/usr/etc/xdg/autostart" && \
cp "/usr/share/applications/steam.desktop" "/usr/etc/xdg/autostart/steam.desktop" && \
sed -i 's@/usr/bin/bazzite-steam %U@/usr/bin/bazzite-steam -silent %U@g' /usr/etc/xdg/autostart/steam.desktop && \
if grep -q "kinoite" <<< "${BASE_IMAGE_NAME}"; then \
sed -i 's/Exec=.*/Exec=systemctl start return-to-gamemode.service/' /etc/skel/Desktop/Return.desktop \
; fi && \
cp "/usr/share/applications/discover_overlay.desktop" "/usr/etc/xdg/autostart/discover_overlay.desktop" && \
sed -i 's@Exec=discover-overlay@Exec=/usr/bin/bazzite-discover-overlay@g' /usr/etc/xdg/autostart/discover_overlay.desktop && \
rm /usr/share/applications/discover_overlay.desktop && \

View File

@ -7,15 +7,16 @@ USER=$(id -nu 1000)
# SteamOS SDDM config
SDDM_CONF='/etc/sddm.conf.d/steamos.conf'
DESKTOP_AUTOLOGIN="/etc/bazzite/desktop_autologin"
AUTOLOGIN_CONF='/etc/sddm.conf.d/zz-steamos-autologin.conf'
DESKTOP_AUTOLOGIN='/etc/bazzite/desktop_autologin'
# Avoid autologin conflict
if [[ -f ${AUTOLOGIN_CONF} ]]; then
rm -f ${AUTOLOGIN_CONF}
fi
# Configure autologin if Steam has been updated
if [[ ! -f $DESKTOP_AUTOLOGIN && -f /var/home/$USER/.local/share/Steam/ubuntu12_32/steamui.so ]]; then
AUTOLOGIN_CONF='/etc/sddm.conf.d/zz-steamos-autologin.conf'
# Avoid autologin conflict
if [[ -f ${AUTOLOGIN_CONF} ]]; then
rm -f ${AUTOLOGIN_CONF}
fi
if [[ ! -f ${DESKTOP_AUTOLOGIN} && -f /var/home/$USER/.local/share/Steam/ubuntu12_32/steamui.so ]]; then
sed -i 's/.*Session=.*/Session=gamescope-session.desktop/g' ${SDDM_CONF}
elif [[ ${BASE_IMAGE_NAME} =~ "kinoite" ]]; then
if ${DESKTOP_WAYLAND}; then

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