Move hotkey monitoring to HotkeyManager init

This commit is contained in:
Beingpax 2025-07-14 22:33:45 +05:45
parent 7986f4411d
commit d08cac5a3a
3 changed files with 5 additions and 7 deletions

View File

@ -116,10 +116,11 @@ class HotkeyManager: ObservableObject {
self.selectedHotkey2 = HotkeyOption(rawValue: UserDefaults.standard.string(forKey: "selectedHotkey2") ?? "") ?? .none
self.whisperState = whisperState
self.miniRecorderShortcutManager = MiniRecorderShortcutManager(whisperState: whisperState)
}
func startHotkeyMonitoring() {
setupHotkeyMonitoring()
Task { @MainActor in
try? await Task.sleep(nanoseconds: 100_000_000)
self.setupHotkeyMonitoring()
}
}
private func setupHotkeyMonitoring() {

View File

@ -191,8 +191,6 @@ struct ContentView: View {
.frame(minWidth: 940, minHeight: 730)
.onAppear {
hasLoadedData = true
// Initialize hotkey monitoring after the app is ready
hotkeyManager.startHotkeyMonitoring()
}
.onReceive(NotificationCenter.default.publisher(for: .navigateToDestination)) { notification in
print("ContentView: Received navigation notification")

View File

@ -161,7 +161,6 @@ struct OnboardingTutorialView: View {
}
}
.onAppear {
hotkeyManager.startHotkeyMonitoring()
animateIn()
isFocused = true
}