Add fallback TTY option (closes #838)

Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
AnErrupTion
2025-09-29 21:30:51 +02:00
parent cee0e0ca4b
commit 7a0520687d
22 changed files with 27 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ err_dgn_oob: []const u8 = "log message",
err_domain: []const u8 = "invalid domain",
err_empty_password: []const u8 = "empty password not allowed",
err_envlist: []const u8 = "failed to get envlist",
err_get_active_tty: []const u8 = "failed to get active tty",
err_hostname: []const u8 = "failed to get hostname",
err_lock_state: []const u8 = "failed to get lock state",
err_log: []const u8 = "failed to open log file",

View File

@@ -509,7 +509,11 @@ pub fn main() !void {
var auth_fails: u64 = 0;
// Switch to selected TTY
const active_tty = try interop.getActiveTty(allocator);
const active_tty = interop.getActiveTty(allocator) catch |err| no_tty_found: {
try info_line.addMessage(lang.err_get_active_tty, config.error_bg, config.error_fg);
try log_writer.print("failed to get active tty: {s}\n", .{@errorName(err)});
break :no_tty_found build_options.fallback_tty;
};
interop.switchTty(active_tty) catch |err| {
try info_line.addMessage(lang.err_switch_tty, config.error_bg, config.error_fg);
try log_writer.print("failed to switch tty: {s}\n", .{@errorName(err)});