Shortcuts to move the active tab in the tab bar
This commit is contained in:
parent
12751a505c
commit
fc046d915d
@ -9,8 +9,11 @@
|
||||
:sc_fifth_window: pass:quotes[`ctrl+shift+5`]
|
||||
:sc_first_window: pass:quotes[`ctrl+shift+1`]
|
||||
:sc_fourth_window: pass:quotes[`ctrl+shift+4`]
|
||||
:sc_move_tab_backward: pass:quotes[`ctrl+shift+,`]
|
||||
:sc_move_tab_forward: pass:quotes[`ctrl+shift+.`]
|
||||
:sc_move_window_backward: pass:quotes[`ctrl+shift+b`]
|
||||
:sc_move_window_forward: pass:quotes[`ctrl+shift+f`]
|
||||
:sc_move_window_to_top: pass:quotes[`ctrl+shift+``]
|
||||
:sc_new_tab: pass:quotes[`ctrl+shift+t`]
|
||||
:sc_new_window: pass:quotes[`ctrl+shift+enter`]
|
||||
:sc_next_layout: pass:quotes[`ctrl+shift+l`]
|
||||
@ -142,6 +145,8 @@ windows are:
|
||||
|Next tab | {sc_next_tab}
|
||||
|Previous tab | {sc_previous_tab}
|
||||
|Next layout | {sc_next_layout}
|
||||
|Move tab forward | {sc_move_tab_forward}
|
||||
|Move tab backward | {sc_move_tab_backward}
|
||||
|
||||
|===
|
||||
|
||||
|
||||
@ -448,4 +448,10 @@ class Boss(Thread):
|
||||
|
||||
def new_tab(self):
|
||||
self.tab_manager.new_tab()
|
||||
|
||||
def move_tab_forward(self):
|
||||
self.queue_action(self.tab_manager.move_tab, 1)
|
||||
|
||||
def move_tab_backward(self):
|
||||
self.queue_action(self.tab_manager.move_tab, -1)
|
||||
# }}}
|
||||
|
||||
@ -165,3 +165,5 @@ map ctrl+shift+left previous_tab
|
||||
map ctrl+shift+t new_tab
|
||||
map ctrl+shift+q close_tab
|
||||
map ctrl+shift+l next_layout
|
||||
map ctrl+shift+. move_tab_forward
|
||||
map ctrl+shift+, move_tab_backward
|
||||
|
||||
@ -253,6 +253,14 @@ class TabManager:
|
||||
def tab_bar_height(self):
|
||||
return 0 if len(self.tabs) < 2 else cell_size.height
|
||||
|
||||
def move_tab(self, delta=1):
|
||||
if len(self.tabs) > 1:
|
||||
idx = self.active_tab_idx
|
||||
nidx = (idx + len(self.tabs) + delta) % len(self.tabs)
|
||||
self.tabs[idx], self.tabs[nidx] = self.tabs[nidx], self.tabs[idx]
|
||||
self.active_tab_idx = nidx
|
||||
glfw_post_empty_event()
|
||||
|
||||
def title_changed(self, new_title):
|
||||
with self.tabbar_lock:
|
||||
self.tabbar_dirty = True
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user