From 15bab74943cc4371b6c4453ff7075e809373c7f0 Mon Sep 17 00:00:00 2001 From: BlackAngelTV Date: Wed, 11 Nov 2026 21:32:09 +0100 Subject: [PATCH] fix(clipboard): paste into the window the picker was opened from The picker overlay is the active window while it is open, so pasting into the active window after a selection went nowhere once it closed. Remember the window the user was working in before showing the list. --- kitty/boss.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kitty/boss.py b/kitty/boss.py index 1d1ea92..5a6a589 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -3171,10 +3171,15 @@ class Boss: self.ring_bell_if_allowed() return previews = [(text, self._clipboard_history_preview(text) or _('(blank)')) for text in entries] + # The picker is itself the active window while it is open, so keep the window the user was + # working in to paste into once it closes. The window can be gone by then. + target = self.window_for_dispatch or self.active_window def chosen(text: str | None) -> None: - if text: - self.paste_to_active_window(text) + if text and target is not None: + w = self.window_id_map.get(target.id) + if w is not None: + w.paste_with_actions(text) self.choose_entry(_('Clipboard history'), previews, chosen)