diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-11 09:27:34 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-11 09:27:34 +0400 |
| commit | cabf712821e63dc7096385ecd4fd9333ad6fe783 (patch) | |
| tree | 9b8da88183dc71f311cd4147ae9371929cf38eec /src | |
| parent | 0931447ec178ed503ff0a085896ec6908cf1292e (diff) | |
| download | niri-cabf712821e63dc7096385ecd4fd9333ad6fe783.tar.gz niri-cabf712821e63dc7096385ecd4fd9333ad6fe783.tar.bz2 niri-cabf712821e63dc7096385ecd4fd9333ad6fe783.zip | |
hotkey-overlay: Deduplicate Spawn actions
Diffstat (limited to 'src')
| -rw-r--r-- | src/hotkey_overlay.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/hotkey_overlay.rs b/src/hotkey_overlay.rs index 284ac0e4..15a46706 100644 --- a/src/hotkey_overlay.rs +++ b/src/hotkey_overlay.rs @@ -216,14 +216,21 @@ fn render(config: &Config, comp_mod: CompositorMod, scale: i32) -> anyhow::Resul } // Add the spawn actions. + let mut spawn_actions = Vec::new(); for bind in binds.iter().filter(|bind| { matches!(bind.actions.first(), Some(Action::Spawn(_))) // Only show binds with Mod or Super to filter out stuff like volume up/down. && (bind.key.modifiers.contains(Modifiers::COMPOSITOR) || bind.key.modifiers.contains(Modifiers::SUPER)) }) { - actions.push(bind.actions.first().unwrap()); + let action = bind.actions.first().unwrap(); + + // We only show one bind for each action, so we need to deduplicate the Spawn actions. + if !spawn_actions.contains(&action) { + spawn_actions.push(action); + } } + actions.extend(spawn_actions); let strings = actions .into_iter() |
