From cabf712821e63dc7096385ecd4fd9333ad6fe783 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 11 Feb 2024 09:27:34 +0400 Subject: hotkey-overlay: Deduplicate Spawn actions --- src/hotkey_overlay.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') 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() -- cgit