Function to swap active window with another

This commit is contained in:
Kovid Goyal 2021-10-17 11:42:02 +05:30
parent f9944e6140
commit c06823dd47
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -567,6 +567,13 @@ class Tab: # {{{
if self.current_layout.move_window_to_group(self.windows, neighbor): if self.current_layout.move_window_to_group(self.windows, neighbor):
self.relayout() 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)') @ac('win', 'Move active window to the top (make it the first window)')
def move_window_to_top(self) -> None: def move_window_to_top(self) -> None:
n = self.windows.active_group_idx n = self.windows.active_group_idx