aboutsummaryrefslogtreecommitdiff
path: root/src/config/model.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-20 18:55:41 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-20 18:55:41 +0300
commit836fd7e585af15cc1ccb0d4f04586ffec28d2a3c (patch)
treea3bf07e7af7ffd884a38fce3d65f8c2243bc0615 /src/config/model.rs
parentbe66f33d2acde30d25794bcead991e5e7b7eaff8 (diff)
feat: add keybinding v2
refs #154 refs #201 refs #202 refs #219
Diffstat (limited to 'src/config/model.rs')
-rw-r--r--src/config/model.rs187
1 files changed, 108 insertions, 79 deletions
diff --git a/src/config/model.rs b/src/config/model.rs
index ff3a7b22..10e80417 100644
--- a/src/config/model.rs
+++ b/src/config/model.rs
@@ -1,6 +1,8 @@
use serde::{Deserialize, Deserializer, Serialize};
-use super::{CommandKeybindConfig, SoundConfig, ThemeConfig, DEFAULT_SCROLLBACK_LIMIT_BYTES};
+use super::{
+ BindingConfig, CommandKeybindConfig, SoundConfig, ThemeConfig, DEFAULT_SCROLLBACK_LIMIT_BYTES,
+};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Default)]
#[serde(rename_all = "lowercase")]
@@ -90,63 +92,81 @@ pub struct LoadedConfig {
#[derive(Debug, Deserialize)]
#[serde(default)]
pub struct KeysConfig {
- /// Prefix key to toggle navigate mode (e.g. "ctrl+b", "f12", "esc").
+ /// Prefix key to enter prefix mode (e.g. "ctrl+b", "f12", "esc").
pub prefix: String,
- /// Create a new workspace. Default: "n"
- pub new_workspace: String,
- /// Rename the selected workspace. Default: "shift+n"
- pub rename_workspace: String,
- /// Close the selected workspace. Default: "shift+d"
- pub close_workspace: String,
- /// Optional explicit detach shortcut in server/client mode. Unset by default.
- pub detach: String,
- /// Reload config.toml in the running app/server. Unset by default.
- pub reload_config: String,
- /// Focus the currently visible notification target. Unset by default.
- pub open_notification_target: String,
+ /// Open keybinding help. Default: "prefix+?"
+ pub help: BindingConfig,
+ /// Open settings. Default: "prefix+s"
+ pub settings: BindingConfig,
+ /// Quit or detach. Default: "prefix+q"
+ pub quit: BindingConfig,
+ /// Create a new workspace. Default: "prefix+shift+n"
+ pub new_workspace: BindingConfig,
+ /// Rename the selected workspace. Default: "prefix+shift+w"
+ pub rename_workspace: BindingConfig,
+ /// Close the selected workspace. Default: "prefix+shift+d"
+ pub close_workspace: BindingConfig,
+ /// Open the workspace navigation surface. Default: "prefix+w"
+ pub workspace_picker: BindingConfig,
+ /// Optional explicit detach shortcut in server/client mode. Default: "prefix+d".
+ pub detach: BindingConfig,
+ /// Reload config.toml in the running app/server. Default: "prefix+shift+r".
+ pub reload_config: BindingConfig,
+ /// Focus the currently visible notification target. Default: "prefix+o".
+ pub open_notification_target: BindingConfig,
/// Select the previous workspace. Unset by default.
- pub previous_workspace: String,
+ pub previous_workspace: BindingConfig,
/// Select the next workspace. Unset by default.
- pub next_workspace: String,
+ pub next_workspace: BindingConfig,
/// Focus the previous agent shown in the agent panel. Unset by default.
- pub previous_agent: String,
+ pub previous_agent: BindingConfig,
/// Focus the next agent shown in the agent panel. Unset by default.
- pub next_agent: String,
- /// Create a new tab in the active workspace. Default: "c"
- pub new_tab: String,
- /// Rename the active tab. Unset by default.
- pub rename_tab: String,
- /// Select the previous tab. Unset by default.
- pub previous_tab: String,
- /// Select the next tab. Unset by default.
- pub next_tab: String,
- /// Close the active tab. Unset by default.
- pub close_tab: String,
- /// Rename the focused pane. Unset by default.
- pub rename_pane: String,
- /// Open the focused pane scrollback in $EDITOR. Unset by default.
- pub edit_scrollback: String,
- /// Focus the pane to the left in terminal mode. Unset by default.
- pub focus_pane_left: String,
- /// Focus the pane below in terminal mode. Unset by default.
- pub focus_pane_down: String,
- /// Focus the pane above in terminal mode. Unset by default.
- pub focus_pane_up: String,
- /// Focus the pane to the right in terminal mode. Unset by default.
- pub focus_pane_right: String,
- /// Split pane vertically (side by side). Default: "v"
- pub split_vertical: String,
- /// Split pane horizontally (stacked). Default: "-"
- pub split_horizontal: String,
- /// Close the focused pane. Default: "x"
- pub close_pane: String,
- /// Toggle zoom for the focused pane. Default: "f"
+ pub next_agent: BindingConfig,
+ /// Focus an agent by index 1-9. Unset by default.
+ pub focus_agent: BindingConfig,
+ /// Create a new tab in the active workspace. Default: "prefix+c"
+ pub new_tab: BindingConfig,
+ /// Rename the active tab. Default: "prefix+shift+t".
+ pub rename_tab: BindingConfig,
+ /// Select the previous tab. Default: "prefix+p".
+ pub previous_tab: BindingConfig,
+ /// Select the next tab. Default: "prefix+n".
+ pub next_tab: BindingConfig,
+ /// Switch to tab 1-9. Default: "prefix+1..9".
+ pub switch_tab: BindingConfig,
+ /// Switch to workspace 1-9 from prefix mode. Unset by default.
+ pub switch_workspace: BindingConfig,
+ /// Close the active tab. Default: "prefix+shift+x".
+ pub close_tab: BindingConfig,
+ /// Rename the focused pane. Default: "prefix+shift+p".
+ pub rename_pane: BindingConfig,
+ /// Open the focused pane scrollback in $EDITOR. Default: "prefix+e".
+ pub edit_scrollback: BindingConfig,
+ /// Focus the pane to the left. Default: "prefix+h".
+ pub focus_pane_left: BindingConfig,
+ /// Focus the pane below. Default: "prefix+j".
+ pub focus_pane_down: BindingConfig,
+ /// Focus the pane above. Default: "prefix+k".
+ pub focus_pane_up: BindingConfig,
+ /// Focus the pane to the right. Default: "prefix+l".
+ pub focus_pane_right: BindingConfig,
+ /// Cycle to the next pane. Default: "prefix+tab".
+ pub cycle_pane_next: BindingConfig,
+ /// Cycle to the previous pane. Default: "prefix+shift+tab".
+ pub cycle_pane_previous: BindingConfig,
+ /// Split pane vertically (side by side). Default: "prefix+v"
+ pub split_vertical: BindingConfig,
+ /// Split pane horizontally (stacked). Default: "prefix+minus"
+ pub split_horizontal: BindingConfig,
+ /// Close the focused pane. Default: "prefix+x"
+ pub close_pane: BindingConfig,
+ /// Toggle zoom for the focused pane. Default: "prefix+z"
#[serde(alias = "fullscreen")]
- pub zoom: String,
- /// Enter resize mode. Default: "r"
- pub resize_mode: String,
- /// Toggle sidebar collapse. Default: "b"
- pub toggle_sidebar: String,
+ pub zoom: BindingConfig,
+ /// Enter resize mode. Default: "prefix+r"
+ pub resize_mode: BindingConfig,
+ /// Toggle sidebar collapse. Default: "prefix+b"
+ pub toggle_sidebar: BindingConfig,
/// Optional indexed shortcuts expanded over number keys 1-9.
pub indexed: IndexedKeysConfig,
/// Prefix-mode custom command bindings.
@@ -212,33 +232,42 @@ impl Default for KeysConfig {
fn default() -> Self {
Self {
prefix: "ctrl+b".into(),
- new_workspace: "n".into(),
- rename_workspace: "shift+n".into(),
- close_workspace: "shift+d".into(),
- detach: "".into(),
- reload_config: "".into(),
- open_notification_target: "".into(),
- previous_workspace: "".into(),
- next_workspace: "".into(),
- previous_agent: "".into(),
- next_agent: "".into(),
- new_tab: "c".into(),
- rename_tab: "".into(),
- previous_tab: "".into(),
- next_tab: "".into(),
- close_tab: "".into(),
- rename_pane: "".into(),
- edit_scrollback: "".into(),
- focus_pane_left: "".into(),
- focus_pane_down: "".into(),
- focus_pane_up: "".into(),
- focus_pane_right: "".into(),
- split_vertical: "v".into(),
- split_horizontal: "-".into(),
- close_pane: "x".into(),
- zoom: "f".into(),
- resize_mode: "r".into(),
- toggle_sidebar: "b".into(),
+ help: BindingConfig::one("prefix+?"),
+ settings: BindingConfig::one("prefix+s"),
+ quit: BindingConfig::one("prefix+q"),
+ new_workspace: BindingConfig::one("prefix+shift+n"),
+ rename_workspace: BindingConfig::one("prefix+shift+w"),
+ close_workspace: BindingConfig::one("prefix+shift+d"),
+ workspace_picker: BindingConfig::one("prefix+w"),
+ detach: BindingConfig::one("prefix+d"),
+ reload_config: BindingConfig::one("prefix+shift+r"),
+ open_notification_target: BindingConfig::one("prefix+o"),
+ previous_workspace: BindingConfig::empty(),
+ next_workspace: BindingConfig::empty(),
+ previous_agent: BindingConfig::empty(),
+ next_agent: BindingConfig::empty(),
+ focus_agent: BindingConfig::empty(),
+ new_tab: BindingConfig::one("prefix+c"),
+ rename_tab: BindingConfig::one("prefix+shift+t"),
+ previous_tab: BindingConfig::one("prefix+p"),
+ next_tab: BindingConfig::one("prefix+n"),
+ switch_tab: BindingConfig::one("prefix+1..9"),
+ switch_workspace: BindingConfig::empty(),
+ close_tab: BindingConfig::one("prefix+shift+x"),
+ rename_pane: BindingConfig::one("prefix+shift+p"),
+ edit_scrollback: BindingConfig::one("prefix+e"),
+ focus_pane_left: BindingConfig::one("prefix+h"),
+ focus_pane_down: BindingConfig::one("prefix+j"),
+ focus_pane_up: BindingConfig::one("prefix+k"),
+ focus_pane_right: BindingConfig::one("prefix+l"),
+ cycle_pane_next: BindingConfig::one("prefix+tab"),
+ cycle_pane_previous: BindingConfig::one("prefix+shift+tab"),
+ split_vertical: BindingConfig::one("prefix+v"),
+ split_horizontal: BindingConfig::one("prefix+minus"),
+ close_pane: BindingConfig::one("prefix+x"),
+ zoom: BindingConfig::one("prefix+z"),
+ resize_mode: BindingConfig::one("prefix+r"),
+ toggle_sidebar: BindingConfig::one("prefix+b"),
indexed: IndexedKeysConfig::default(),
command: Vec::new(),
}