From fd5f0a3b9c775a98a1f69f2588e391fb272fc301 Mon Sep 17 00:00:00 2001 From: RJ Trujillo Date: Sat, 15 Jul 2023 09:02:14 -0600 Subject: [PATCH] fix(autologin): Retrieve user by id This will always retrieve the first user created on the system and doesn't rely on there only being one user in the home directory --- system_files/deck/usr/bin/gamescope-autologin | 7 ++----- system_files/deck/usr/bin/plasma-autologin | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/system_files/deck/usr/bin/gamescope-autologin b/system_files/deck/usr/bin/gamescope-autologin index 804f7707..06483b67 100755 --- a/system_files/deck/usr/bin/gamescope-autologin +++ b/system_files/deck/usr/bin/gamescope-autologin @@ -1,16 +1,13 @@ #!/usr/bin/env bash -NUM_USERS=$(ls /home | wc -l) -USER=$(ls /home) +USER=$(id -nu 1000) # 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 - sed -i 's/.*User=.*/User='${USER}'/g' ${SDDM_CONF} -fi +sed -i 's/.*User=.*/User='${USER}'/g' ${SDDM_CONF} # Remove sddm.conf if it exists if [ -f '/etc/sddm.conf' ]; then diff --git a/system_files/deck/usr/bin/plasma-autologin b/system_files/deck/usr/bin/plasma-autologin index 51bdab00..0627c80e 100755 --- a/system_files/deck/usr/bin/plasma-autologin +++ b/system_files/deck/usr/bin/plasma-autologin @@ -1,16 +1,13 @@ #!/usr/bin/env bash -NUM_USERS=$(ls /home | wc -l) -USER=$(ls /home) +USER=$(id -nu 1000) # 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 +sed -i 's/.*User=.*/User='${USER}'/g' ${SDDM_CONF} # Remove sddm.conf if it exists if [ -f '/etc/sddm.conf' ]; then