From eec83179b93d63b18cb253e1ad8c41d8a9b155d8 Mon Sep 17 00:00:00 2001 From: Jackson Delahunt Date: Wed, 1 Apr 2026 19:00:37 +0200 Subject: [PATCH] config: add shell option to hide the shell session (#955) The shell session is unconditionally added to the session list with no way to hide it. This is inconsistent with `xinitrc`, which is omitted from the list when set to `null`. This change adds a `shell` boolean config option (default `true`). Setting it to `false` hides the shell session from the list, following the same pattern as `xinitrc`. Co-authored-by: Jackson Delahunt Reviewed-on: https://codeberg.org/fairyglade/ly/pulls/955 Reviewed-by: AnErrupTion Co-authored-by: Jackson Delahunt Co-committed-by: Jackson Delahunt --- res/config.ini | 4 ++++ src/config/Config.zig | 1 + src/main.zig | 26 ++++++++++++++------------ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/res/config.ini b/res/config.ini index 4970520..86f44b4 100644 --- a/res/config.ini +++ b/res/config.ini @@ -330,6 +330,10 @@ session_log = .local/state/ly-session.log # Setup command setup_cmd = $CONFIG_DIRECTORY/ly/setup.sh +# Show the shell session in the session list +# If false, the shell session will be hidden +shell = true + # Specifies the key combination used for showing the password show_password_key = F7 diff --git a/src/config/Config.zig b/src/config/Config.zig index c0a4350..2233cb4 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -83,6 +83,7 @@ save: bool = true, service_name: [:0]const u8 = "ly", session_log: ?[]const u8 = "ly-session.log", setup_cmd: []const u8 = build_options.config_directory ++ "/ly/setup.sh", +shell: bool = true, show_password_key: []const u8 = "F7", show_tty: bool = false, shutdown_cmd: []const u8 = "/sbin/shutdown -a now", diff --git a/src/main.zig b/src/main.zig index 08c5177..bd9294c 100644 --- a/src/main.zig +++ b/src/main.zig @@ -737,18 +737,20 @@ pub fn main() !void { try state.buffer.registerKeybind(&state.login.label.keybinds, "H", &viGoLeft, &state); try state.buffer.registerKeybind(&state.login.label.keybinds, "L", &viGoRight, &state); - addOtherEnvironment(&state.session, state.lang, .shell, null) catch |err| { - try state.info_line.addMessage( - state.lang.err_alloc, - state.config.error_bg, - state.config.error_fg, - ); - try state.log_file.err( - "sys", - "failed to add shell environment: {s}", - .{@errorName(err)}, - ); - }; + if (state.config.shell) { + addOtherEnvironment(&state.session, state.lang, .shell, null) catch |err| { + try state.info_line.addMessage( + state.lang.err_alloc, + state.config.error_bg, + state.config.error_fg, + ); + try state.log_file.err( + "sys", + "failed to add shell environment: {s}", + .{@errorName(err)}, + ); + }; + } if (build_options.enable_x11_support) { if (state.config.xinitrc) |xinitrc_cmd| {