about summary refs log tree commit diff stats
path: root/pkgs/by-name/ri/river-mk-keymap/src
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/ri/river-mk-keymap/src')
-rw-r--r--pkgs/by-name/ri/river-mk-keymap/src/key_map/mod.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/pkgs/by-name/ri/river-mk-keymap/src/key_map/mod.rs b/pkgs/by-name/ri/river-mk-keymap/src/key_map/mod.rs
index 60ed41b8..5c89c2e2 100644
--- a/pkgs/by-name/ri/river-mk-keymap/src/key_map/mod.rs
+++ b/pkgs/by-name/ri/river-mk-keymap/src/key_map/mod.rs
@@ -29,6 +29,9 @@ pub struct KeyConfig {
     /// Whether to allow this key mapping in the “locked” mode.
     #[serde(default)]
     allow_locked: bool,
+
+    /// Use a different description to display this command, instead of the `command`.
+    description: Option<String>,
 }
 
 impl FromStr for KeyMap {
@@ -48,6 +51,7 @@ impl FromStr for KeyMap {
                         .collect::<Option<_>>()
                         .ok_or(anyhow!("A array contained a non-string value: {value:#?}"))?,
                     allow_locked: false,
+                    description: None,
                 }
             } else if let Some(object) = value.as_object() {
                 if object.contains_key("command") {
@@ -100,7 +104,11 @@ impl FromStr for KeyMap {
 }
 impl Display for KeyConfig {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        f.write_str(self.command.join(" ").as_str())
+        if let Some(desc) = &self.description {
+            f.write_str(desc)
+        } else {
+            f.write_str(self.command.join(" ").as_str())
+        }
     }
 }