Check for session file name in autologin (closes #895)

Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
AnErrupTion
2025-12-30 17:38:22 +01:00
parent add7f25f0d
commit b1cb576f67
2 changed files with 6 additions and 3 deletions

View File

@@ -1251,6 +1251,7 @@ fn crawl(session: *Session, lang: Lang, path: []const u8, display_server: Displa
});
errdefer entry_ini.deinit();
const file_name = std.fs.path.stem(item.name);
const entry = entry_ini.data.@"Desktop Entry";
var maybe_xdg_session_desktop: ?[]const u8 = null;
var maybe_xdg_desktop_names: ?[]const u8 = null;
@@ -1268,15 +1269,15 @@ fn crawl(session: *Session, lang: Lang, path: []const u8, display_server: Displa
} else if (display_server != .custom) {
// If DesktopNames is empty, and this isn't a custom session entry,
// we'll take the name of the session file
const stem = std.fs.path.stem(item.name);
if (stem.len > 0) {
maybe_xdg_session_desktop = try session.label.allocator.dupe(u8, stem);
if (file_name.len > 0) {
maybe_xdg_session_desktop = try session.label.allocator.dupe(u8, file_name);
xdg_session_desktop_owned = true;
}
}
try session.addEnvironment(.{
.entry_ini = entry_ini,
.file_name = std.fs.path.stem(item.name),
.name = entry.Name,
.xdg_session_desktop = maybe_xdg_session_desktop,
.xdg_session_desktop_owned = xdg_session_desktop_owned,
@@ -1310,6 +1311,7 @@ fn findSessionByName(session: *Session, name: []const u8) ?usize {
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;
}