aboutsummaryrefslogtreecommitdiff
path: root/src/config
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-21 15:17:37 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-21 15:17:37 +0300
commit06bcd06a17be3bd242e2b8230dd9b803b1969f3c (patch)
treeecec609d7cccd346a81d749c63b094ce3a97a11f /src/config
parentdde0ddb3aec0522f2bc4c6fa1cb7d25f99fc8403 (diff)
feat: use local keybindings for remote attach
Diffstat (limited to 'src/config')
-rw-r--r--src/config/keybinds.rs10
-rw-r--r--src/config/model.rs5
2 files changed, 8 insertions, 7 deletions
diff --git a/src/config/keybinds.rs b/src/config/keybinds.rs
index 3a4cf754..1c9c491b 100644
--- a/src/config/keybinds.rs
+++ b/src/config/keybinds.rs
@@ -1,7 +1,7 @@
#[cfg(test)]
use crossterm::event::KeyEvent;
use crossterm::event::{KeyCode, KeyModifiers};
-use serde::Deserialize;
+use serde::{Deserialize, Serialize};
use tracing::warn;
use super::Config;
@@ -9,13 +9,13 @@ use crate::input::TerminalKey;
pub type KeyCombo = (KeyCode, KeyModifiers);
-#[derive(Debug)]
+#[derive(Debug, Clone)]
pub struct LiveKeybindConfig {
pub prefix: KeyCombo,
pub keybinds: Keybinds,
}
-#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
+#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[serde(untagged)]
pub enum BindingConfig {
One(String),
@@ -45,7 +45,7 @@ impl BindingConfig {
}
}
-#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Default)]
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Default)]
#[serde(rename_all = "snake_case")]
pub enum CommandKeybindType {
#[default]
@@ -53,7 +53,7 @@ pub enum CommandKeybindType {
Pane,
}
-#[derive(Debug, Clone, Deserialize)]
+#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(default)]
pub struct CommandKeybindConfig {
/// Key that runs a command. Use `prefix+g` for prefix mode or a modified chord for direct mode.
diff --git a/src/config/model.rs b/src/config/model.rs
index 40d425a3..e099d510 100644
--- a/src/config/model.rs
+++ b/src/config/model.rs
@@ -89,7 +89,7 @@ pub struct LoadedConfig {
pub invalid_sections: Vec<String>,
}
-#[derive(Debug, Deserialize)]
+#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(default)]
pub struct KeysConfig {
/// Prefix key to enter prefix mode (e.g. "ctrl+b", "f12", "esc").
@@ -168,10 +168,11 @@ pub struct KeysConfig {
/// Optional indexed shortcuts expanded over number keys 1-9.
pub indexed: IndexedKeysConfig,
/// Prefix-mode custom command bindings.
+ #[serde(skip_serializing_if = "Vec::is_empty")]
pub command: Vec<CommandKeybindConfig>,
}
-#[derive(Debug, Default, Deserialize)]
+#[derive(Debug, Default, Clone, Deserialize, Serialize)]
#[serde(default)]
pub struct IndexedKeysConfig {
/// Modifier combo for tab shortcuts 1-9. Unset by default.