Shortcuts: Add shortcuts to move tab left or right
This commit is contained in:
parent
9e25930106
commit
b59d5434f2
|
@ -141,6 +141,20 @@
|
||||||
<property name="title" translatable="yes">Switch to the next unread tab</property>
|
<property name="title" translatable="yes">Switch to the next unread tab</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="visible">1</property>
|
||||||
|
<property name="accelerator"><ctrl><shift>Page_Up</property>
|
||||||
|
<property name="title" translatable="yes">Move tab to the left</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkShortcutsShortcut">
|
||||||
|
<property name="visible">1</property>
|
||||||
|
<property name="accelerator"><ctrl><shift>Page_Down</property>
|
||||||
|
<property name="title" translatable="yes">Move tab to the right</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkShortcutsShortcut">
|
<object class="GtkShortcutsShortcut">
|
||||||
<property name="visible">1</property>
|
<property name="visible">1</property>
|
||||||
|
|
|
@ -121,6 +121,7 @@ class MessageWindow:
|
||||||
keys = ['<Control>f', '<Control>g', '<Control>h', '<Control>i',
|
keys = ['<Control>f', '<Control>g', '<Control>h', '<Control>i',
|
||||||
'<Control>l', '<Control>L', '<Control><Shift>n', '<Control>u',
|
'<Control>l', '<Control>L', '<Control><Shift>n', '<Control>u',
|
||||||
'<Control>b', '<Control>F4',
|
'<Control>b', '<Control>F4',
|
||||||
|
'<Control><Shift>Page_Up', '<Control><Shift>Page_Down',
|
||||||
'<Control>w', '<Control>Page_Up', '<Control>Page_Down', '<Alt>Right',
|
'<Control>w', '<Control>Page_Up', '<Control>Page_Down', '<Alt>Right',
|
||||||
'<Alt>Left', '<Alt>d', '<Alt>c', '<Alt>m', '<Alt>t', 'Escape'] + \
|
'<Alt>Left', '<Alt>d', '<Alt>c', '<Alt>m', '<Alt>t', 'Escape'] + \
|
||||||
['<Alt>'+str(i) for i in range(10)]
|
['<Alt>'+str(i) for i in range(10)]
|
||||||
|
@ -411,7 +412,8 @@ class MessageWindow:
|
||||||
'gtk-key-theme-name') == 'Emacs':
|
'gtk-key-theme-name') == 'Emacs':
|
||||||
self.remove_tab(control, self.CLOSE_CTRL_KEY)
|
self.remove_tab(control, self.CLOSE_CTRL_KEY)
|
||||||
return True
|
return True
|
||||||
elif keyval in (Gdk.KEY_Page_Up, Gdk.KEY_Page_Down):
|
elif keyval in (Gdk.KEY_Page_Up, Gdk.KEY_Page_Down) and not \
|
||||||
|
modifier & Gdk.ModifierType.SHIFT_MASK:
|
||||||
# CTRL + PageUp | PageDown
|
# CTRL + PageUp | PageDown
|
||||||
# Create event and send it to notebook
|
# Create event and send it to notebook
|
||||||
event = Gdk.Event.new(Gdk.EventType.KEY_PRESS)
|
event = Gdk.Event.new(Gdk.EventType.KEY_PRESS)
|
||||||
|
@ -429,6 +431,20 @@ class MessageWindow:
|
||||||
self.window.lookup_action(
|
self.window.lookup_action(
|
||||||
'change-nick-%s' % control.control_id).activate()
|
'change-nick-%s' % control.control_id).activate()
|
||||||
return True
|
return True
|
||||||
|
# CTRL + SHIFT + PageUp | PageDown
|
||||||
|
old_position = self.notebook.get_current_page()
|
||||||
|
total_pages = self.notebook.get_n_pages()
|
||||||
|
if keyval == Gdk.KEY_Page_Up:
|
||||||
|
self.notebook.reorder_child(control.widget,
|
||||||
|
old_position - 1)
|
||||||
|
return True
|
||||||
|
if keyval == Gdk.KEY_Page_Down:
|
||||||
|
if old_position == total_pages - 1:
|
||||||
|
self.notebook.reorder_child(control.widget, 0)
|
||||||
|
return True
|
||||||
|
self.notebook.reorder_child(control.widget,
|
||||||
|
old_position + 1)
|
||||||
|
return True
|
||||||
# MOD1 (ALT) mask
|
# MOD1 (ALT) mask
|
||||||
elif modifier & Gdk.ModifierType.MOD1_MASK:
|
elif modifier & Gdk.ModifierType.MOD1_MASK:
|
||||||
# Tab switch bindings
|
# Tab switch bindings
|
||||||
|
|
Loading…
Reference in New Issue