hotkey-overlay: Deduplicate Spawn actions
Browse files at this commitcabf712821e63dc7096385ecd4fd9333ad6fe783Parent: 09314471 changed file +8 -1
- src/hotkey_overlay.rs +8 -1
src/hotkey_overlay.rsmodified+8 -1
| @@ -216,14 +216,21 @@ fn render(config: &Config, comp_mod: CompositorMod, scale: i32) -> anyhow::Resul | ||
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | // Add the spawn actions. |
| 219 | + let mut spawn_actions = Vec::new(); | |
| 219 | 220 | for bind in binds.iter().filter(|bind| { |
| 220 | 221 | matches!(bind.actions.first(), Some(Action::Spawn(_))) |
| 221 | 222 | // Only show binds with Mod or Super to filter out stuff like volume up/down. |
| 222 | 223 | && (bind.key.modifiers.contains(Modifiers::COMPOSITOR) |
| 223 | 224 | || bind.key.modifiers.contains(Modifiers::SUPER)) |
| 224 | 225 | }) { |
| 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 | + } | |
| 226 | 232 | } |
| 233 | + actions.extend(spawn_actions); | |
| 227 | 234 | |
| 228 | 235 | let strings = actions |
| 229 | 236 | .into_iter() |