diff --git a/kitty/boss.py b/kitty/boss.py index d65a19187..30bc46d12 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -1104,7 +1104,10 @@ class Boss: set_colors(self, self.active_window, payload) def _move_window_to(self, window=None, target_tab_id=None, target_os_window_id=None): - src_tab = self.tab_for_window(window or self.active_window) + window = window or self.active_window + if not window: + return + src_tab = self.tab_for_window(window) if src_tab is None: return if target_os_window_id == 'new': @@ -1126,6 +1129,12 @@ class Boss: return underlaid_window, overlaid_window = src_tab.detach_window(window) - target_tab.attach_window(underlaid_window) + if underlaid_window: + target_tab.attach_window(underlaid_window) if overlaid_window: target_tab.attach_window(overlaid_window) + + def detach_window(self, *args): + if not args: + return self._move_window_to(target_tab_id='new') + # TODO: Implementthis diff --git a/kitty/config.py b/kitty/config.py index 558fe400c..c5576e6e4 100644 --- a/kitty/config.py +++ b/kitty/config.py @@ -92,6 +92,11 @@ def goto_tab_parse(func, rest): return func, args +@func_with_args('detach_window') +def detach_window_parse(func, rest): + return func, to_cmdline(rest) + + @func_with_args('set_background_opacity', 'goto_layout', 'kitty_shell') def simple_parse(func, rest): return func, [rest] diff --git a/kitty/tabs.py b/kitty/tabs.py index c24e0039d..d0a173538 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -58,7 +58,7 @@ class Tab: # {{{ setattr(self, which + '_window', partial(self.nth_window, num=i)) self._last_used_layout = self._current_layout_name = None if no_initial_window: - pass + self._set_current_layout(self.enabled_layouts[0]) elif session_tab is None: self.cwd = self.args.directory sl = self.enabled_layouts[0]