Have toggling the quick access terminal via the kitten also move it to the active monitor

This commit is contained in:
Kovid Goyal 2025-09-23 07:31:42 +05:30
parent edda367abb
commit 8b8918ee4b
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 11 additions and 3 deletions

View file

@ -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

View file

@ -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))

View file

@ -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}