forge
Explore
Log in

Don't you dare go Hollow

hotkey-overlay: Deduplicate Spawn actions

Browse files at this commit

cabf712821e63dc7096385ecd4fd9333ad6fe783Ivan MolodetskikhParent: 0931447
src/hotkey_overlay.rsmodified+8 -1
@@ -216,14 +216,21 @@ fn render(config: &Config, comp_mod: CompositorMod, scale: i32) -> anyhow::Resul
216216 }
217217
218218 // Add the spawn actions.
219+ let mut spawn_actions = Vec::new();
219220 for bind in binds.iter().filter(|bind| {
220221 matches!(bind.actions.first(), Some(Action::Spawn(_)))
221222 // Only show binds with Mod or Super to filter out stuff like volume up/down.
222223 && (bind.key.modifiers.contains(Modifiers::COMPOSITOR)
223224 || bind.key.modifiers.contains(Modifiers::SUPER))
224225 }) {
225- actions.push(bind.actions.first().unwrap());
226+ let action = bind.actions.first().unwrap();
227+
228+ // We only show one bind for each action, so we need to deduplicate the Spawn actions.
229+ if !spawn_actions.contains(&action) {
230+ spawn_actions.push(action);
231+ }
226232 }
233+ actions.extend(spawn_actions);
227234
228235 let strings = actions
229236 .into_iter()