feat(bazzite-autologin): Merge gamescope and desktop autologin

I started messing with systemd conditions to ensure that one ran before
the other and vice versa, but this is a whole lot simpler.

If Steam has updated, launch gamescope. If not, start to desktop
This commit is contained in:
RJ Trujillo 2023-09-12 16:36:22 -06:00
parent 975986f849
commit 967d52511a
6 changed files with 13 additions and 39 deletions

View File

@ -380,8 +380,7 @@ RUN rm /usr/share/applications/wine*.desktop && \
systemctl disable gdm.service && \
systemctl enable sddm.service \
; fi && \
systemctl enable desktop-autologin.service && \
systemctl enable gamescope-autologin.service && \
systemctl enable bazzite-autologin.service && \
systemctl enable jupiter-fan-control.service && \
systemctl enable btrfs-dedup@run-media-mmcblk0p1.timer && \
systemctl enable vpower.service && \

View File

@ -8,8 +8,15 @@ USER=$(id -nu 1000)
# SteamOS SDDM config
SDDM_CONF='/etc/sddm.conf.d/steamos.conf'
# Configure SDDM autologin
if [[ ${BASE_IMAGE_NAME} =~ "kinoite" ]]; then
# Configure autologin if Steam has been updated
if [[ -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
sed -i 's/.*Session=.*/Session=gamescope-session.desktop/g' ${SDDM_CONF}
elif [[ ${BASE_IMAGE_NAME} =~ "kinoite" ]]; then
if ${DESKTOP_WAYLAND}; then
sed -i 's/.*Session=.*/Session=plasma.desktop/g' ${SDDM_CONF}
else

View File

@ -1,21 +0,0 @@
#!/usr/bin/env bash
USER=$(id -nu 1000)
# SteamOS SDDM config
SDDM_CONF='/etc/sddm.conf.d/steamos.conf'
AUTOLOGIN_CONF='/etc/sddm.conf.d/zz-steamos-autologin.conf'
# Avoid autologin conflict
if [[ -f ${AUTOLOGIN_CONF} ]]; then
rm -f ${AUTOLOGIN_CONF}
fi
# Configure autologin if Steam has been updated
if [[ -f /var/home/$USER/.local/share/Steam/ubuntu12_32/steamui.so ]]; then
sed -i 's/.*Session=.*/Session=gamescope-session.desktop/g' ${SDDM_CONF}
sed -i 's/.*User=.*/User='${USER}'/g' ${SDDM_CONF}
if systemctl is-enabled --quiet desktop-autologin; then
systemctl disable --now desktop-autologin
fi
fi

View File

@ -1,8 +1,7 @@
polkit.addRule(function(action, subject) {
if (subject.isInGroup("wheel") &&
action.id == "org.freedesktop.systemd1.manage-units" &&
(action.lookup("unit") == "desktop-autologin.service" ||
action.lookup("unit") == "gamescope-autologin.service"))
action.lookup("unit") == "bazzite-autologin.service")
{
return polkit.Result.YES;
}

View File

@ -1,10 +1,10 @@
[Unit]
Description=Enables autologin to desktop
Description=Enables Bazzite autologin
Before=display-manager.service
[Service]
Type=oneshot
ExecStart=/usr/bin/desktop-autologin
ExecStart=/usr/bin/bazzite-autologin
[Install]
WantedBy=multi-user.target

View File

@ -1,10 +0,0 @@
[Unit]
Description=Enables autologin to gamescope-session
Before=display-manager.service
[Service]
Type=oneshot
ExecStart=/usr/bin/gamescope-autologin
[Install]
WantedBy=multi-user.target