Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

fix: reject overlapping modifier-only hotkey shortcuts

altic-dev3b33b1e5b8e6
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 17cee7da..5c9c24aa 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -894,6 +894,9 @@ struct ContentView: View {
if configuredShortcut == shortcut {
return "Duplicate with \(otherTarget.title)"
}
+ if shortcut.conflictsWith(configuredShortcut) {
+ return "Overlaps \(otherTarget.title) — use a different modifier key"
+ }
}
let targetPromptKey = target.promptConfigurationKey
@@ -906,6 +909,9 @@ struct ContentView: View {
if assignment.shortcut == shortcut {
return "Duplicate with Prompt Shortcut"
}
+ if shortcut.conflictsWith(assignment.shortcut) {
+ return "Overlaps Prompt Shortcut — use a different modifier key"
+ }
}
return nil
diff --git a/Sources/Fluid/Models/HotkeyShortcut.swift b/Sources/Fluid/Models/HotkeyShortcut.swift
index c6996041..7fd17be7 100644
--- a/Sources/Fluid/Models/HotkeyShortcut.swift
+++ b/Sources/Fluid/Models/HotkeyShortcut.swift
@@ -191,6 +191,20 @@ extension HotkeyShortcut {
Self.modifierFlag(forKeyCode: self.keyCode)
}
+ /// True when two modifier-only shortcuts would overlap — either identical
+ /// or one is a subset of the other's modifiers (e.g. ⌥ vs ⌥+⇧). Prevents
+ /// the shared `modifierOnlyKeyDown` release race in GlobalHotkeyManager.
+ func conflictsWith(_ other: HotkeyShortcut) -> Bool {
+ guard self.isModifierOnlyShortcut, other.isModifierOnlyShortcut else { return false }
+
+ let lhs = Set(self.normalizedModifierKeyCodes)
+ let rhs = Set(other.normalizedModifierKeyCodes)
+
+ guard !lhs.isEmpty, !rhs.isEmpty else { return false }
+
+ return lhs.isSubset(of: rhs) || rhs.isSubset(of: lhs)
+ }
+
var isModifierOnlyShortcut: Bool {
self.modifierTriggerFlag != nil
}