fix autologin

Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
2025-07-12 11:53:15 +05:00
parent cc42d327ee
commit 33e06fb5ec
2 changed files with 9 additions and 8 deletions

View File

@ -1,4 +1,4 @@
[Seat:*]
#autologin-user=
#autologin-user-timeout=
#autologin-session=
#autologin-user=
autologin-user-timeout=

View File

@ -17,7 +17,7 @@ mkdir -p "${config_dir}/environment.d"
[[ -f "$config_dir/$SENTINEL_FILE" ]] && source "$config_dir/$SENTINEL_FILE"
session="${1:-gamescope}"
session="${1:-portprotonqt}"
session_launcher=""
create_sentinel=""
@ -45,9 +45,9 @@ update_config_sentinel() {
}
configure_lightdm() {
sed -i "s/^.*autologin-user=.*/autologin-user=${USER}/" /etc/lightdm/lightdm.conf.d/10-gamescope-session.conf
sed -i "s/^.*autologin-user-timeout=.*/autologin-user-timeout=0/" /etc/lightdm/lightdm.conf.d/10-gamescope-session.conf
sed -i "s/^.*autologin-session=.*/autologin-session=$session_launcher/" /etc/lightdm/lightdm.conf.d/10-gamescope-session.conf
sed -i "s/^.*autologin-user=.*/autologin-user=${USER}/" /etc/lightdm/lightdm.conf.d/10-gamescope-session.conf
systemctl reset-failed lightdm
systemctl restart lightdm
}
@ -55,11 +55,12 @@ configure_sddm() {
sed -i "s/^.*Relogin=.*/Relogin=true/" /etc/sddm.conf.d/10-gamescope-session.conf
sed -i "s/^.*Session=.*/Session=$session_launcher/" /etc/sddm.conf.d/10-gamescope-session.conf
sed -i "s/^.*User=.*/User=${USER}/" /etc/sddm.conf.d/10-gamescope-session.conf
systemctl reset-failed sddm
systemctl restart sddm
}
yad_question() {
yad --window-icon="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --image="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --question --title="$1" --text="$2" --width=300 --text-align=center
yad --window-icon="/usr/share/icons/hicolor/scalable/actions/portprotonqt-gaming-return.svg" --image="/usr/share/icons/hicolor/scalable/actions/portprotonqt-gaming-return.svg" --question --title="$1" --text="$2" --width=300 --text-align=center
[[ "$?" != 0 ]] && return 1 || return 0
}
@ -132,7 +133,7 @@ if [[ ! -z $4 ]]; then
fi
if systemctl is-active --quiet gdm; then
yad --window-icon="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --image="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --title="Требуется подтверждение" --text="Для работы данной функции требуется LIGHTDM или SDDM, GDM не поддерживается" --width=290 --text-align=center --button="OK"
yad --window-icon="/usr/share/icons/hicolor/scalable/actions/portprotonqt-gaming-return.svg" --image="/usr/share/icons/hicolor/scalable/actions/portprotonqt-gaming-return.svg" --title="Требуется подтверждение" --text="Для работы данной функции требуется LIGHTDM или SDDM, GDM не поддерживается" --width=290 --text-align=center --button="OK"
if [[ -f "$config_dir/$SENTINEL_FILE" ]]; then
if grep -iq "autologin" "$config_dir/$SENTINEL_FILE"; then
if ! grep -q "autologin=false" "$config_dir/$SENTINEL_FILE"; then
@ -149,7 +150,7 @@ if systemctl is-active --quiet gdm; then
die "Autologin configuration aborted due to GDM."
fi
if ! grep -iq "autologin" "$config_dir/$SENTINEL_FILE" && [[ "$2" == "desktop" ]]; then
if ! grep -iq "autologin" "$config_dir/$SENTINEL_FILE"; then
if yad_question "Требуется подтверждение" "Для работы данной функции требуется настроить автологин. Хотите ли вы, чтобы это было настроено автоматически?" ; then
echo "autologin=true" >> "$config_dir/$SENTINEL_FILE"
echo "autologin enabled"