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 dock visibility and locked-screen shortcuts

altic-dev43668220e2c9
diff --git a/Sources/Fluid/AppDelegate.swift b/Sources/Fluid/AppDelegate.swift
index c379d2b9..5a8d09cf 100644
--- a/Sources/Fluid/AppDelegate.swift
+++ b/Sources/Fluid/AppDelegate.swift
@@ -118,7 +118,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
return true
}
- // Ensure dock-icon reopen always foregrounds FluidVoice.
+ // LaunchServices can restore the bundle's regular activation policy when
+ // reopening a running app, so reapply the user's Dock preference first.
+ self.applyDockVisibilityPolicy()
sender.activate(ignoringOtherApps: true)
return !self.bringMainWindowToFrontIfPresent()
diff --git a/Sources/Fluid/Services/GlobalHotkeyManager.swift b/Sources/Fluid/Services/GlobalHotkeyManager.swift
index a857f385..0ca8b2f1 100644
--- a/Sources/Fluid/Services/GlobalHotkeyManager.swift
+++ b/Sources/Fluid/Services/GlobalHotkeyManager.swift
@@ -698,6 +698,14 @@ final class GlobalHotkeyManager: NSObject {
self.clearPrimaryShortcutPressState()
}
+ nonisolated static func sessionIsLocked(sessionInfo: [String: Any]) -> Bool {
+ sessionInfo["CGSSessionScreenIsLocked"] as? Bool ?? false
+ }
+
+ private nonisolated static func currentSessionIsLocked() -> Bool {
+ self.sessionIsLocked(sessionInfo: CGSessionCopyCurrentDictionary() as? [String: Any] ?? [:])
+ }
+
private nonisolated func clearPrimaryShortcutPressState() {
let task = self.state.withLock { () -> Task<Void, Never>? in
guard self.state.activePrimaryShortcutPress != nil || self.state.isKeyPressed else { return nil }
@@ -1897,6 +1905,10 @@ final class GlobalHotkeyManager: NSObject {
}
private func canTriggerRecordingAction(_ label: String) -> Bool {
+ guard !Self.currentSessionIsLocked() else {
+ DebugLogger.shared.info("Ignoring \(label) - screen is locked", source: "GlobalHotkeyManager")
+ return false
+ }
guard !self.isProcessingStop else {
DebugLogger.shared.debug("Ignoring \(label) - stop already processing", source: "GlobalHotkeyManager")
return false
diff --git a/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swift b/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swift
index 94f46769..b5135751 100644
--- a/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swift
+++ b/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swift
@@ -19,6 +19,12 @@ final class HotkeyShortcutTests: XCTestCase {
private let experimentalDirectAudioCaptureEnabledKey = "ExperimentalDirectAudioCaptureEnabled"
private let incrementalParakeetEnabledKey = "ExperimentalParakeetUnifiedFinalEnabled"
+ func testHotkeySessionLockDetection() {
+ XCTAssertTrue(GlobalHotkeyManager.sessionIsLocked(sessionInfo: ["CGSSessionScreenIsLocked": true]))
+ XCTAssertFalse(GlobalHotkeyManager.sessionIsLocked(sessionInfo: ["CGSSessionScreenIsLocked": false]))
+ XCTAssertFalse(GlobalHotkeyManager.sessionIsLocked(sessionInfo: [:]))
+ }
+
@MainActor
func testBottomOverlayRapidStopStartStopDoesNotDropFinalHide() async {
let audioPublisher = Just(CGFloat.zero).eraseToAnyPublisher()