Broadcast kitten: map to match current tab #3183
-
Hi all, I'm trying to create a mapping to trigger the new Broadcast kitten matching only the current tab windows. At this moment I'm using a "kitten wrapper" but I'm sure there is a better solution:
# broadcast_to_current_tab.py
from kittens.tui.handler import result_handler
def main(args):
pass
@result_handler(no_ui=True)
def handle_result(args, answer, target_window_id, boss):
tab = boss.active_tab
boss.launch(
"--allow-remote-control",
"--type=os-window",
"--title=Broadcast",
"/bin/bash",
"-lc",
f"kitty +kitten broadcast --match-tab=id:{tab.id}",
) Many thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Just use --match-tab and specify the window id, this will select the tab containing the window. The only issue is if there is also a tab with the same id, in that case it will select that tab instead, but this should be relatively rare. If that is a problem for you, it should be an easy patch to add window_id based matching to --match-tab. |
Beta Was this translation helpful? Give feedback.
-
Hey! I just saw your last commit, that simplifies it a lot. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Worth mentioning the recent improvement. |
Beta Was this translation helpful? Give feedback.
Just use --match-tab and specify the window id, this will select the tab containing the window. The only issue is if there is also a tab with the same id, in that case it will select that tab instead, but this should be relatively rare. If that is a problem for you, it should be an easy patch to add window_id based matching to --match-tab.