From 69d39dc035de58ec43db76c3f9c58aa8f4f62a52 Mon Sep 17 00:00:00 2001 From: AnErrupTion Date: Fri, 29 Aug 2025 00:32:49 +0200 Subject: [PATCH] Remove config.load config.save already makes it redundant. Besides, who would want to save the current username & session, but not want to load it at the next boot? Signed-off-by: AnErrupTion --- res/config.ini | 5 +---- src/config/Config.zig | 1 - src/main.zig | 6 +++--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/res/config.ini b/res/config.ini index dc37004..3efc716 100644 --- a/res/config.ini +++ b/res/config.ini @@ -200,9 +200,6 @@ input_len = 34 # Available languages are found in $CONFIG_DIRECTORY/ly/lang/ lang = en -# Load the saved desktop and username -load = true - # Command executed when logging in # If null, no command will be executed # Important: the code itself must end with `exec "$@"` in order to launch the session! @@ -243,7 +240,7 @@ restart_cmd = /sbin/shutdown -r now # Specifies the key used for restart (F1-F12) restart_key = F2 -# Save the current desktop and login as defaults +# Save the current desktop and login as defaults, and load them on startup save = true # Service name (set to ly to use the provided pam config file) diff --git a/src/config/Config.zig b/src/config/Config.zig index 89919a6..26eb29a 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -52,7 +52,6 @@ hide_key_hints: bool = false, initial_info_text: ?[]const u8 = null, input_len: u8 = 34, lang: []const u8 = "en", -load: bool = true, login_cmd: ?[]const u8 = null, login_defs_path: []const u8 = "/etc/login.defs", logout_cmd: ?[]const u8 = null, diff --git a/src/main.zig b/src/main.zig index e91ac04..76ebde3 100644 --- a/src/main.zig +++ b/src/main.zig @@ -164,7 +164,7 @@ pub fn main() !void { .comment_characters = comment_characters, }) catch Lang{}; - if (config.load) { + if (config.save) { save_path = try std.fmt.allocPrint(allocator, "{s}{s}save.ini", .{ s, trailing_slash }); save_path_alloc = true; @@ -197,7 +197,7 @@ pub fn main() !void { .comment_characters = comment_characters, }) catch Lang{}; - if (config.load) { + if (config.save) { var user_buf: [32]u8 = undefined; save = save_ini.readFileToStruct(save_path, .{ .fieldHandler = null, @@ -383,7 +383,7 @@ pub fn main() !void { var insert_mode = !config.vi_mode or config.vi_default_mode == .insert; // Load last saved username and desktop selection, if any - if (config.load) { + if (config.save) { if (save.user) |user| { // Find user with saved name, and switch over to it // If it doesn't exist (anymore), we don't change the value