mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-20 19:24:53 +00:00
Add fallback TTY option (closes #838)
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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)});
|
||||
|
||||
Reference in New Issue
Block a user