diff --git a/kitty/boss.py b/kitty/boss.py index 8f2dea8fc..0e3f02939 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -434,4 +434,6 @@ class Boss(Thread): def previous_tab(self): self.queue_action(self.tab_manager.next_tab, -1) + def new_tab(self): + self.tab_manager.new_tab() # }}} diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 55567c379..b09bc6c1d 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -144,5 +144,7 @@ map ctrl+shift+w close_window map ctrl+shift+l next_layout # Tab management -map ctrl+shift+right next_tab -map ctrl+shift+left previous_tab +map ctrl+shift+right next_tab +map ctrl+shift+left previous_tab +map ctrl+shift+t new_tab +map ctrl+shift+q close_tab diff --git a/kitty/tabs.py b/kitty/tabs.py index 93dca41f9..27ded928f 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -29,12 +29,13 @@ class Tab: self.active_window_idx = 0 if session_tab is None: self.cwd = args.directory - self.current_layout = self.enabled_layouts[0] + l = self.enabled_layouts[0] queue_action(self.new_window) else: self.cwd = session_tab.cwd or args.directory - self.current_layout = all_layouts[session_tab.layout](opts, self.borders.border_width, self.windows) + l = session_tab.layout queue_action(self.startup, session_tab) + self.current_layout = all_layouts[l](opts, self.borders.border_width, self.windows) def startup(self, session_tab): for cmd in session_tab.windows: @@ -210,6 +211,10 @@ class TabManager: def __len__(self): return len(self.tabs) + def new_tab(self): + self.active_tab_idx = len(self.tabs) + self.tabs.append(Tab(self.opts, self.args, self.title_changed)) + @property def active_tab(self): return self.tabs[self.active_tab_idx] if self.tabs else None