From 8b8918ee4bc1fe6673e5ce9afa89fe1337da948e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 23 Sep 2025 07:31:42 +0530 Subject: [PATCH] Have toggling the quick access terminal via the kitten also move it to the active monitor --- kittens/panel/main.py | 4 ++-- kittens/quick_access_terminal/main.go | 2 +- kitty/simple_cli_definitions.py | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/kittens/panel/main.py b/kittens/panel/main.py index b58289007..b89b806a7 100644 --- a/kittens/panel/main.py +++ b/kittens/panel/main.py @@ -171,7 +171,7 @@ def handle_single_instance_command(boss: BossType, sys_args: Sequence[str], envi for os_window_id in boss.os_window_map: existing = layer_shell_config_for_os_window(os_window_id) layer_shell_config_changed = not existing or any(f for f in lsc._fields if getattr(lsc, f) != existing.get(f)) - toggle_os_window_visibility(os_window_id) + toggle_os_window_visibility(os_window_id, move_to_active_screen=args.move_to_active_monitor) if layer_shell_config_changed: set_layer_shell_config(os_window_id, lsc) return @@ -184,7 +184,7 @@ def handle_single_instance_command(boss: BossType, sys_args: Sequence[str], envi def main(sys_args: list[str]) -> None: - # run_kitten run using runpy.run_module which does not import into + # run_kitten runs using runpy.run_module which does not import into # sys.modules, which means the module will be re-imported later, causing # global variables to be duplicated, so do it now. from kittens.panel.main import actual_main diff --git a/kittens/quick_access_terminal/main.go b/kittens/quick_access_terminal/main.go index e150b11b6..c73503ceb 100644 --- a/kittens/quick_access_terminal/main.go +++ b/kittens/quick_access_terminal/main.go @@ -37,7 +37,7 @@ func main(cmd *cli.Command, opts *Options, args []string) (rc int, err error) { if err != nil { return 1, err } - argv := []string{kitty_exe, "+kitten", "panel", "--toggle-visibility", "--exclusive-zone=0", "--override-exclusive-zone", "--layer=overlay", "--single-instance"} + argv := []string{kitty_exe, "+kitten", "panel", "--toggle-visibility", "--exclusive-zone=0", "--override-exclusive-zone", "--layer=overlay", "--single-instance", "--move-to-active-monitor"} argv = append(argv, fmt.Sprintf("--lines=%s", conf.Lines)) argv = append(argv, fmt.Sprintf("--columns=%s", conf.Columns)) argv = append(argv, fmt.Sprintf("--edge=%s", conf.Edge)) diff --git a/kitty/simple_cli_definitions.py b/kitty/simple_cli_definitions.py index cc9ae2721..63bea6840 100644 --- a/kitty/simple_cli_definitions.py +++ b/kitty/simple_cli_definitions.py @@ -747,6 +747,14 @@ When set and using :option:`--single-instance` will toggle the visibility of the existing panel rather than creating a new one. +--move-to-active-monitor +type=bool-set +default=false +When set and using :option:`--toggle-visibility` to show an existing panel, the panel +is moved to the active monitor (typically the monitor with the mouse on it). +This works only if the underlying OS supports it. It is currently supported on macOS only. + + --start-as-hidden type=bool-set default={start_as_hidden}