Add Shortcut Toggle

This commit is contained in:
Hariharan Mudaliar 2025-08-12 14:01:29 +05:30
commit 5e206ec20b
6 changed files with 225 additions and 233 deletions

View file

@ -373,6 +373,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
KeyboardShortcuts.onKeyDown(for: .toggleSneakPeek) { [weak self] in
guard let self = self else { return }
// Only execute if shortcuts are enabled
guard Defaults[.enableShortcuts] else { return }
self.coordinator.toggleSneakPeek(
status: !self.coordinator.sneakPeek.show,
type: .music,
@ -383,6 +387,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
KeyboardShortcuts.onKeyDown(for: .toggleNotchOpen) { [weak self] in
guard let self = self else { return }
// Only execute if shortcuts are enabled
guard Defaults[.enableShortcuts] else { return }
let mouseLocation = NSEvent.mouseLocation
var viewModel = self.vm
@ -418,6 +425,13 @@ class AppDelegate: NSObject, NSApplicationDelegate {
KeyboardShortcuts.onKeyDown(for: .startDemoTimer) { [weak self] in
guard let self = self else { return }
// Only execute if shortcuts are enabled
guard Defaults[.enableShortcuts] else { return }
// Only start timer if the timer feature is enabled
guard Defaults[.enableTimerFeature] else { return }
// Start a 5-minute demo timer
TimerManager.shared.startDemoTimer(duration: 300)
}
@ -425,6 +439,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
KeyboardShortcuts.onKeyDown(for: .clipboardHistoryPanel) { [weak self] in
guard let self = self else { return }
// Only execute if shortcuts are enabled
guard Defaults[.enableShortcuts] else { return }
// Only open clipboard if the feature is enabled
guard Defaults[.enableClipboardManager] else { return }