Replies: 2 comments 2 replies
-
You need
I'm also curious to know how this can be done, which seems unlikely at the moment. Here is the source code that affects this: kitty/boss.py def _run_kitten( ... ) -> Any:
# ...
if end_kitten.no_ui:
return end_kitten(None, getattr(w, 'id', None), self)
# ... You can see that stdin_data is given None and then returned directly. EDIT: from typing import List
from kitty.boss import Boss
from kittens.tui.handler import result_handler
def main(args: List[str]) -> None:
return None
@result_handler(no_ui=True)
def handle_result(args: List[str], stdin_data: str, target_window_id: int, boss: Boss) -> None:
w = boss.window_id_map.get(target_window_id)
if w is not None and w.screen.cursor_at_prompt():
w.paste(w.cmd_output()) |
Beta Was this translation helpful? Give feedback.
-
I just learned that you can get the effect you want with a mapping like this:
It copies the output from the last command to the primary selection and then pastes it. |
Beta Was this translation helpful? Give feedback.
-
I really like the new shell integration features in 0.24 and I am currently trying to write a small helper/kitten for something I wanted for a long time: Paste the result of the last command at the cursor position:
The docs for kittens list the various kinds of
type_of_input
I can pass to theresult_handler
, but it is not clear to me where this then available.no_ui
means themain
function isn't executed, but themain
function had the comment:This sounds like the
last_visited_output
I want is somehow only available in themain
function, but I would prefer to keepno_ui=True
to prevent the somewhat annoying flicker.with
no_ui=False
this at least pastesmain_result
. Butdef main(args): return sys.stdin.read()
pastes nothing again.What I had expected and found ideal for my scenario would be that with
no_ui=True
the requestedtype_of_input
is directly available instdin_data
and I could simply use it for pasting.Where in this process am I misunderstanding the design and execution of kittens?
Beta Was this translation helpful? Give feedback.
All reactions