diff --git a/Containerfile b/Containerfile index f379786e..5a0025f3 100644 --- a/Containerfile +++ b/Containerfile @@ -160,6 +160,7 @@ RUN sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_kylegospo-bazzite.re sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_kylegospo-hl2linux-selinux.repo && \ sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_kylegospo-obs-vkcapture.repo && \ sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/_copr_kylegospo-wallpaper-engine-kde-plugin.repo && \ + systemctl enable plasma-autologin.service && \ systemctl enable jupiter-fan-control.service && \ systemctl enable set-cfs-tweaks.service && \ systemctl disable input-remapper.service && \ diff --git a/system_files/deck/usr/bin/gamescope-autologin b/system_files/deck/usr/bin/gamescope-autologin index f9dae3fd..804f7707 100755 --- a/system_files/deck/usr/bin/gamescope-autologin +++ b/system_files/deck/usr/bin/gamescope-autologin @@ -1,19 +1,18 @@ -#!/bin/bash -NUM_USERS=$(ls /home | wc -l) +#!/usr/bin/env bash -# If we have multiple users, don't configure SDDM +NUM_USERS=$(ls /home | wc -l) +USER=$(ls /home) + +# SteamOS SDDM config +SDDM_CONF='/etc/sddm.conf.d/steamos.conf' + +# Configure autologin +sed -i 's/.*Session=.*/Session=gamescope-session.desktop/g' ${SDDM_CONF} if [ ${NUM_USERS} -eq 1 ]; then - # Don't configure SDDM if we already have - SDDM_CONF=$(cat /etc/sddm.conf.d/steamos.conf) - if grep '#User=' <<< ${SDDM_CONF}; then - # Retrieve username - USER=$(ls /home) - # Configure autologin - sed -i 's/#User=/User='${USER}'/g' /etc/sddm.conf.d/steamos.conf - touch /etc/sddm.conf.d/zz-steamos-autologin.conf - # Remove sddm.conf if it exists - if [ -f '/etc/sddm.conf' ]; then - rm -f /etc/sddm.conf - fi - fi + sed -i 's/.*User=.*/User='${USER}'/g' ${SDDM_CONF} +fi + +# Remove sddm.conf if it exists +if [ -f '/etc/sddm.conf' ]; then + rm -f /etc/sddm.conf fi diff --git a/system_files/deck/usr/bin/plasma-autologin b/system_files/deck/usr/bin/plasma-autologin new file mode 100755 index 00000000..51bdab00 --- /dev/null +++ b/system_files/deck/usr/bin/plasma-autologin @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +NUM_USERS=$(ls /home | wc -l) +USER=$(ls /home) + +# SteamOS SDDM config +SDDM_CONF='/etc/sddm.conf.d/steamos.conf' + +# Configure autologin +sed -i 's/.*Session=.*/Session=plasmax11.desktop/g' ${SDDM_CONF} +if [ ${NUM_USERS} -eq 1 ]; then + sed -i 's/.*User=.*/User='${USER}'/g' ${SDDM_CONF} +fi + +# Remove sddm.conf if it exists +if [ -f '/etc/sddm.conf' ]; then + rm -f /etc/sddm.conf +fi diff --git a/system_files/deck/usr/lib/systemd/system/plasma-autologin.service b/system_files/deck/usr/lib/systemd/system/plasma-autologin.service new file mode 100644 index 00000000..fc1197a8 --- /dev/null +++ b/system_files/deck/usr/lib/systemd/system/plasma-autologin.service @@ -0,0 +1,10 @@ +[Unit] +Description=Enables autologin to Plasma (X11) +Before=display-manager.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/plasma-autologin + +[Install] +WantedBy=multi-user.target diff --git a/system_files/deck/usr/share/ublue-os/firstboot/yafti.yml b/system_files/deck/usr/share/ublue-os/firstboot/yafti.yml index 857a6dab..87cf9bf9 100644 --- a/system_files/deck/usr/share/ublue-os/firstboot/yafti.yml +++ b/system_files/deck/usr/share/ublue-os/firstboot/yafti.yml @@ -164,7 +164,7 @@ screens: description: Autologin to Gamescope Session default: true packages: - - Enable Gamescope Autologin: systemctl enable gamescope-autologin + - Enable Gamescope Autologin: just enable-gamescope-autologin Greenlight: description: A utility for xCloud and xHome streaming default: false diff --git a/system_files/deck/usr/share/ublue-os/just/custom.just b/system_files/deck/usr/share/ublue-os/just/custom.just index 9ee3eae0..63ad9de4 100644 --- a/system_files/deck/usr/share/ublue-os/just/custom.just +++ b/system_files/deck/usr/share/ublue-os/just/custom.just @@ -1,3 +1,11 @@ +enable-gamescope-autologin: + systemctl disable --now plasma-autologin + systemctl enable --now gamescope-autologin + +enable-plasma-autologin: + systemctl disable --now gamescope-autologin + systemctl enable --now plasma-autologin + set-steamos-kargs: rpm-ostree kargs --append="amd_pstate=active" --append="amd_iommu=off" --append="amdgpu.gttsize=8128" --append="spi_amd.speed_dev=1"