Last active
October 1, 2024 10:19
-
-
Save Ethorbit/725e878a04f632b7476399c5151c96e8 to your computer and use it in GitHub Desktop.
Switch Steam Deck desktop user with a single sudo command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
user="$1" | |
if ! [[ `id "$user" 2> /dev/null` ]]; then | |
echo "Not a valid user" 1>&2 && exit 1 | |
fi | |
if [[ `echo "$user" | grep "|"` ]]; then | |
echo "Username cannot have '|'" 1>&2 && exit 1 | |
fi | |
if [[ `grep "User=$user" /etc/sddm.conf.d/steamos.conf` ]]; then | |
echo "User already set" 1>&1 && exit | |
fi | |
sed -i "s|^User=.*|User=$user|" /etc/sddm.conf.d/steamos.conf | |
/sbin/systemctl restart sddm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to force a specific user on boot, you can create a systemd service:
/etc/systemd/system/default-session-user.service
sudo systemctl enable default-session-user.service