mirror of
https://github.com/fairyglade/ly.git
synced 2026-09-22 03:50:23 +00:00
config: Add grab_focus_tty (closes #1039)
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -316,6 +316,13 @@ ly = {
|
||||
-- Example: a string of "23" makes the cell survive on 2 or 3 neighbors
|
||||
gameoflife_param_survival = "23",
|
||||
|
||||
-- Sets the TTY on which to always grab focus on.
|
||||
-- This is useful if you want to have deterministic behavior when starting
|
||||
-- Ly on multiple TTYs simultaneously.
|
||||
-- If null, Ly will always try to grab focus on the TTY it is launched on,
|
||||
-- even if multiple instances are launched.
|
||||
grab_focus_tty = nil,
|
||||
|
||||
-- Remove main box borders
|
||||
hide_borders = false,
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ gameoflife_frame_delay: usize = 6,
|
||||
gameoflife_initial_density: f32 = 0.4,
|
||||
gameoflife_param_birth: []const u8 = "3",
|
||||
gameoflife_param_survival: []const u8 = "23",
|
||||
grab_focus_tty: ?u8 = null,
|
||||
hide_borders: bool = false,
|
||||
inactivity_cmd: ?[]const u8 = null,
|
||||
inactivity_delay: u16 = 0,
|
||||
|
||||
@@ -1007,7 +1007,10 @@ pub fn main(init: std.process.Init) !void {
|
||||
);
|
||||
break :no_tty_found build_options.fallback_tty;
|
||||
};
|
||||
if (!state.use_kmscon_vt) {
|
||||
if (!state.use_kmscon_vt) switch_tty: {
|
||||
if (state.config.grab_focus_tty) |tty| {
|
||||
if (tty != state.active_tty) break :switch_tty;
|
||||
}
|
||||
interop.switchTty(state.active_tty) catch |err| {
|
||||
try state.info_line.addMessage(
|
||||
state.lang.err_switch_tty,
|
||||
|
||||
Reference in New Issue
Block a user