Fix wrong session being chosen in autologin (closes #911)

Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
AnErrupTion
2026-01-18 21:35:49 +01:00
parent d7f64676ee
commit 2eea683078
2 changed files with 4 additions and 4 deletions

View File

@@ -62,7 +62,7 @@ auto_login_service = ly-autologin
# To find available session names, check the .desktop files in: # To find available session names, check the .desktop files in:
# - /usr/share/xsessions/ (for X11 sessions) # - /usr/share/xsessions/ (for X11 sessions)
# - /usr/share/wayland-sessions/ (for Wayland sessions) # - /usr/share/wayland-sessions/ (for Wayland sessions)
# Use the filename without .desktop extension, or the value of DesktopNames field # Use the filename without .desktop extension, the Name field inside the file or the value of the DesktopNames field
# Examples: "i3", "sway", "gnome", "plasma", "xfce" # Examples: "i3", "sway", "gnome", "plasma", "xfce"
# If null, automatic login is disabled # If null, automatic login is disabled
auto_login_session = null auto_login_session = null

View File

@@ -1300,14 +1300,14 @@ fn isValidUsername(username: []const u8, usernames: StringList) bool {
fn findSessionByName(session: *Session, name: []const u8) ?usize { fn findSessionByName(session: *Session, name: []const u8) ?usize {
for (session.label.list.items, 0..) |env, i| { for (session.label.list.items, 0..) |env, i| {
if (std.ascii.eqlIgnoreCase(env.environment.file_name, name)) return i;
if (std.ascii.eqlIgnoreCase(env.environment.name, name)) return i;
if (env.environment.xdg_session_desktop) |session_desktop| { if (env.environment.xdg_session_desktop) |session_desktop| {
if (session_desktop.len > 0 and std.ascii.eqlIgnoreCase(session_desktop, name)) return i; if (session_desktop.len > 0 and std.ascii.eqlIgnoreCase(session_desktop, name)) return i;
} }
if (env.environment.xdg_desktop_names) |session_desktop_name| { if (env.environment.xdg_desktop_names) |session_desktop_name| {
if (std.ascii.eqlIgnoreCase(session_desktop_name, name)) return i; if (std.ascii.eqlIgnoreCase(session_desktop_name, name)) return i;
} }
if (std.ascii.eqlIgnoreCase(env.environment.name, name)) return i;
if (std.ascii.eqlIgnoreCase(env.environment.file_name, name)) return i;
} }
return null; return null;
} }