mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-24 02:01:18 +07:00
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>
This commit is contained in:
@@ -1031,6 +1031,8 @@ pub struct Struts {
|
|||||||
pub struct HotkeyOverlay {
|
pub struct HotkeyOverlay {
|
||||||
#[knuffel(child)]
|
#[knuffel(child)]
|
||||||
pub skip_at_startup: bool,
|
pub skip_at_startup: bool,
|
||||||
|
#[knuffel(child)]
|
||||||
|
pub hide_not_bound: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(knuffel::Decode, Debug, Default, Clone, Copy, PartialEq, Eq)]
|
#[derive(knuffel::Decode, Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||||
@@ -4610,6 +4612,7 @@ mod tests {
|
|||||||
},
|
},
|
||||||
hotkey_overlay: HotkeyOverlay {
|
hotkey_overlay: HotkeyOverlay {
|
||||||
skip_at_startup: true,
|
skip_at_startup: true,
|
||||||
|
hide_not_bound: false,
|
||||||
},
|
},
|
||||||
animations: Animations {
|
animations: Animations {
|
||||||
off: false,
|
off: false,
|
||||||
|
|||||||
@@ -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
|
let strings = actions
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|action| format_bind(binds, mod_key, action))
|
.filter_map(|action| format_bind(binds, mod_key, action))
|
||||||
|
|||||||
@@ -225,6 +225,8 @@ clipboard {
|
|||||||
|
|
||||||
Settings for the "Important Hotkeys" overlay.
|
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.
|
Set the `skip-at-startup` flag if you don't want to see the hotkey help at niri startup.
|
||||||
|
|
||||||
```kdl
|
```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).
|
You can customize which binds the hotkey overlay shows using the [`hotkey-overlay-title` property](./Configuration:-Key-Bindings.md#custom-hotkey-overlay-titles).
|
||||||
|
|||||||
Reference in New Issue
Block a user