aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Daleng <kent.daleng@nav.no>2025-06-03 19:31:18 +0200
committerGitHub <noreply@github.com>2025-06-03 20:31:18 +0300
commitabac28a65c6c742114ef292221dd26e2a3a2f04b (patch)
tree72451a9fbbd594cbab56f6c15c34e448fb3dadad
parenta7186a0441fe866784a601c6192850267802dca5 (diff)
downloadniri-abac28a65c6c742114ef292221dd26e2a3a2f04b.tar.gz
niri-abac28a65c6c742114ef292221dd26e2a3a2f04b.tar.bz2
niri-abac28a65c6c742114ef292221dd26e2a3a2f04b.zip
add option to hide unbound actions in hotkey overlay (#1618)
* add option to hide unbound actions in hotkey overlay * fix config test, add some docs * Add kdl language hint Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com> * Improve docs Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com> * hide_unbound -> hide_not_bound * forgot to rename in wiki * filter actions before calling format * use any instead of contains * retain instead of filter --------- Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
-rw-r--r--niri-config/src/lib.rs3
-rw-r--r--src/ui/hotkey_overlay.rs5
-rw-r--r--wiki/Configuration:-Miscellaneous.md13
3 files changed, 21 insertions, 0 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs
index 012db9e9..83689a4b 100644
--- a/niri-config/src/lib.rs
+++ b/niri-config/src/lib.rs
@@ -1031,6 +1031,8 @@ pub struct Struts {
pub struct HotkeyOverlay {
#[knuffel(child)]
pub skip_at_startup: bool,
+ #[knuffel(child)]
+ pub hide_not_bound: bool,
}
#[derive(knuffel::Decode, Debug, Default, Clone, Copy, PartialEq, Eq)]
@@ -4610,6 +4612,7 @@ mod tests {
},
hotkey_overlay: HotkeyOverlay {
skip_at_startup: true,
+ hide_not_bound: false,
},
animations: Animations {
off: false,
diff --git a/src/ui/hotkey_overlay.rs b/src/ui/hotkey_overlay.rs
index 1430a9d6..7042d2c0 100644
--- a/src/ui/hotkey_overlay.rs
+++ b/src/ui/hotkey_overlay.rs
@@ -285,6 +285,11 @@ fn render(
}
}
+ if config.hotkey_overlay.hide_not_bound {
+ // Only keep actions that have been bound
+ actions.retain(|&action| binds.iter().any(|bind| bind.action == *action))
+ }
+
let strings = actions
.into_iter()
.filter_map(|action| format_bind(binds, mod_key, action))
diff --git a/wiki/Configuration:-Miscellaneous.md b/wiki/Configuration:-Miscellaneous.md
index 1da2cb67..0fb26c41 100644
--- a/wiki/Configuration:-Miscellaneous.md
+++ b/wiki/Configuration:-Miscellaneous.md
@@ -225,6 +225,8 @@ clipboard {
Settings for the "Important Hotkeys" overlay.
+#### `skip-at-startup`
+
Set the `skip-at-startup` flag if you don't want to see the hotkey help at niri startup.
```kdl
@@ -233,4 +235,15 @@ hotkey-overlay {
}
```
+#### `hide-not-bound`
+
+By default, niri will show the most important actions even if they aren't bound to any key, to prevent confusion.
+Set the `hide-not-bound` flag if you want to hide all actions not bound to any key.
+
+```kdl
+hotkey-overlay {
+ hide-not-bound
+}
+```
+
You can customize which binds the hotkey overlay shows using the [`hotkey-overlay-title` property](./Configuration:-Key-Bindings.md#custom-hotkey-overlay-titles).