From 01746578e0a60047bf7c92d91636e2de65a7161a Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Fri, 26 Dec 2025 15:36:41 +0000 Subject: Fix desktop_to_dm in any::get_autologin() to handle new session names. There are now multiple session files in /usr/share/xsessions and in /usr/share/wayland-sessions for each DE, so the old hash table was both broken and inadequate. Replace with a subroutine that uses case-insensitive regex matching, which should be more future-proof. --- perl-install/any.pm | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'perl-install') diff --git a/perl-install/any.pm b/perl-install/any.pm index dc0d112e1..f334bf700 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -842,6 +842,21 @@ sub available_dms() { @l; } +sub desktop_to_dm { + my ($desktop) = @_; + if ($desktop =~ /gnome/i) { + 'gdm'; + } elsif ($desktop =~ /lxqt|plasma/i) { + 'sddm'; + } elsif ($desktop =~ /cinnamon|mate|xfce/i) { + 'lightdm'; + } elsif ($desktop =~ /lxde/i) { + 'lxdm'; + } else { + ''; + } +} + sub get_autologin() { my %desktop = getVarsFromSh("$::prefix/etc/sysconfig/desktop"); my $gdm_file = "$::prefix/etc/X11/gdm/custom.conf"; @@ -850,15 +865,9 @@ sub get_autologin() { my $lxdm_conffile = "$::prefix/etc/lxdm/lxdm.conf"; my $autologin_file = "$::prefix/etc/sysconfig/autologin"; my $desktop = $desktop{DESKTOP} || first(sessions()); - my %desktop_to_dm = ( - GNOME => 'gdm', - Plasma => 'sddm', - Xfce => 'lightdm', - LXDE => 'lxdm', - ); my $dm = basename(readlink("$::prefix/etc/systemd/system/display-manager.service")) =~ s/(.*)\.service/$1/r || - $desktop_to_dm{$desktop} || + desktop_to_dm($desktop) || basename(first(available_dms())); my $autologin_user; -- cgit v1.2.1