From 0c3797ec90b775c96d8c05a5979fb65fa8841cf2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 24 Apr 2025 06:30:33 +0530 Subject: [PATCH] Implement --detach for panel kitten --- docs/kittens/panel.rst | 2 +- kittens/panel/main.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/kittens/panel.rst b/docs/kittens/panel.rst index 0a7462b68..a1f2850de 100644 --- a/docs/kittens/panel.rst +++ b/docs/kittens/panel.rst @@ -80,7 +80,7 @@ disappears at a key press. To do so use the following command:: kitty +kitten panel --edge=top --layer=overlay --lines=15 \ --focus-policy=exclusive --exclusive-zone=0 --override-exclusive-zone \ -o background_opacity=0.8 --toggle-visibility --single-instance \ - --instance-group=quake + --instance-group=quake --detach Run this command in a terminal, and a quick access kitty panel will show up at the top of your screen. Run it again, and the panel will be hidden. diff --git a/kittens/panel/main.py b/kittens/panel/main.py index 7e60e129e..d860b4e39 100644 --- a/kittens/panel/main.py +++ b/kittens/panel/main.py @@ -183,6 +183,11 @@ type=bool-set Start in hidden mode, useful with :option:`--toggle-visibility`. +--detach +type=bool-set +Detach from the controlling terminal, if any. + + --debug-rendering type=bool-set For internal debugging use. @@ -338,6 +343,9 @@ def handle_single_instance_command(boss: BossType, sys_args: Sequence[str], envi def main(sys_args: list[str]) -> None: global args args, items = parse_panel_args(sys_args[1:]) + if args.detach: + from kitty.utils import detach + detach() sys.argv = ['kitty'] if args.debug_rendering: sys.argv.append('--debug-rendering')