@@ -465,6 +465,7 @@ linux_install_light_gui_apt() {
465465 sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
466466 xorg xfce4 lightdm xserver-xorg-video-dummy dbus-x11 x11-xserver-utils || true
467467
468+ echo " /usr/sbin/lightdm" | sudo tee /etc/X11/default-display-manager > /dev/null
468469 sudo mkdir -p /etc/lightdm/lightdm.conf.d
469470 sudo tee /etc/lightdm/lightdm.conf.d/50-phantom-xfce.conf > /dev/null << 'EOF '
470471[Seat:*]
@@ -657,14 +658,34 @@ linux_configure_autologin() {
657658}
658659
659660linux_autologin_configure_display_manager () {
661+ _default_dm=" $( basename " $( cat /etc/X11/default-display-manager 2> /dev/null || true) " ) "
662+
663+ if [ " $_default_dm " = " lightdm" ] \
664+ || systemctl is-active --quiet lightdm 2> /dev/null \
665+ || systemctl is-enabled --quiet lightdm 2> /dev/null; then
666+ linux_autologin_lightdm
667+ return 0
668+ fi
669+
670+ if [ " $_default_dm " = " gdm3" ] || [ " $_default_dm " = " gdm" ] \
671+ || systemctl is-active --quiet gdm3 2> /dev/null \
672+ || systemctl is-active --quiet gdm 2> /dev/null \
673+ || systemctl is-enabled --quiet gdm3 2> /dev/null \
674+ || systemctl is-enabled --quiet gdm 2> /dev/null; then
675+ linux_autologin_gdm
676+ return 0
677+ fi
678+
660679 if [ -d /etc/lightdm ] || [ -f /etc/lightdm/lightdm.conf ]; then
661680 linux_autologin_lightdm
662681 return 0
663682 fi
683+
664684 linux_autologin_gdm
665685}
666686
667687linux_autologin_lightdm () {
688+ echo " /usr/sbin/lightdm" | sudo tee /etc/X11/default-display-manager > /dev/null
668689 sudo mkdir -p /etc/lightdm/lightdm.conf.d
669690 sudo tee /etc/lightdm/lightdm.conf.d/60-phantom-autologin.conf > /dev/null << EOF
670691# Written by phantom install.sh --autologin
681702linux_autologin_gdm () {
682703 # 1. GDM autologin (Ubuntu 22/24 default DM)
683704 if [ -f /etc/gdm3/custom.conf ]; then
705+ echo " /usr/sbin/gdm3" | sudo tee /etc/X11/default-display-manager > /dev/null
684706 # Back up original once so we can revert cleanly later
685707 if [ ! -f /etc/gdm3/custom.conf.phantom-bak ]; then
686708 sudo cp /etc/gdm3/custom.conf /etc/gdm3/custom.conf.phantom-bak
@@ -708,6 +730,7 @@ TimedLoginDelay = 5
708730
709731[debug]
710732EOF
733+ sudo systemctl enable gdm3 > /dev/null 2>&1 || true
711734 echo " Enabled GDM autologin for $TARGET_USER "
712735 else
713736 echo " WARN: /etc/gdm3/custom.conf not found. Only GDM is supported here — configure autologin manually for your DM."
0 commit comments