Add moving tabs left and right with key shortcuts

This commit is contained in:
vacenty 2026-01-18 01:31:24 +01:00
parent 9129277bed
commit 003a9b3b06
4 changed files with 49 additions and 1 deletions

View file

@ -87,6 +87,8 @@ pub enum KeyBindAction {
TabNew,
TabNext,
TabPrev,
TabMoveLeft,
TabMoveRight,
ToggleFullscreen,
WindowClose,
WindowNew,
@ -127,6 +129,8 @@ impl KeyBindAction {
Self::TabNew => Some(Action::TabNew),
Self::TabNext => Some(Action::TabNext),
Self::TabPrev => Some(Action::TabPrev),
Self::TabMoveLeft => Some(Action::TabMoveLeft),
Self::TabMoveRight => Some(Action::TabMoveRight),
Self::ToggleFullscreen => Some(Action::ToggleFullscreen),
Self::WindowClose => Some(Action::WindowClose),
Self::WindowNew => Some(Action::WindowNew),
@ -288,6 +292,8 @@ pub fn action_label(action: KeyBindAction) -> String {
KeyBindAction::TabNew => fl!("new-tab"),
KeyBindAction::TabNext => fl!("next-tab"),
KeyBindAction::TabPrev => fl!("previous-tab"),
KeyBindAction::TabMoveLeft => fl!("move-tab-left"),
KeyBindAction::TabMoveRight => fl!("move-tab-right"),
KeyBindAction::ToggleFullscreen => fl!("toggle-fullscreen"),
KeyBindAction::WindowClose => fl!("close-window"),
KeyBindAction::WindowNew => fl!("new-window"),
@ -470,6 +476,10 @@ fn fallback_shortcuts() -> Shortcuts {
bind!([Ctrl], "Tab", TabNext);
bind!([Ctrl, Shift], "Tab", TabPrev);
// Ctrl+Shift+PageUp/Down move tabs left and right
bind!([Ctrl, Shift], "PageUp", TabMoveLeft);
bind!([Ctrl, Shift], "PageDown", TabMoveRight);
// Ctrl+Shift+# activates tabs by index
bind!([Ctrl, Shift], "1", TabActivate0);
bind!([Ctrl, Shift], "2", TabActivate1);