From c06823dd479acbc6059fadcbc80b973703e4a47d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 17 Oct 2021 11:42:02 +0530 Subject: [PATCH] Function to swap active window with another --- kitty/tabs.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kitty/tabs.py b/kitty/tabs.py index d03b19235..b25562d10 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -567,6 +567,13 @@ class Tab: # {{{ if self.current_layout.move_window_to_group(self.windows, neighbor): self.relayout() + def swap_active_window_with(self, window_id: int) -> None: + group = self.windows.group_for_window(window_id) + if group is not None: + w = self.active_window + if w is not None and w.id != window_id: + self.current_layout.move_window_to_group(self.windows, group.id) + @ac('win', 'Move active window to the top (make it the first window)') def move_window_to_top(self) -> None: n = self.windows.active_group_idx