mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-03-29 22:20:21 +00:00
Merge pull request #313 from ublue-os/return-to-gamemode
feat(deck): Add service to return to gaming mode
This commit is contained in:
commit
70f776c6fb
@ -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 && \
|
||||
|
@ -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
|
||||
|
22
system_files/deck/shared/usr/bin/return-to-gamemode
Executable file
22
system_files/deck/shared/usr/bin/return-to-gamemode
Executable 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
|
@ -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;
|
||||
}
|
||||
})
|
@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=Return to Gaming Mode
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/return-to-gamemode
|
Loading…
x
Reference in New Issue
Block a user