feat: allow to switch shortcuts while the ui is already open

This commit is contained in:
decodism authored and Louis Pontoise committed 2023-02-22 19:43:53 +01:00
1 parent f53c070ca1
commit b99c988970
3 files changed
+3 -4

No files matched your search

+1 -1
View File
@@ -60,7 +60,7 @@ class ATShortcut {
func shouldTrigger() -> Bool {
if scope == .global {
if triggerPhase == .down && (!App.app.appIsBeingUsed || index == App.app.shortcutIndex) {
if triggerPhase == .down && (!App.app.appIsBeingUsed || index == nil || index == App.app.shortcutIndex) {
App.app.appIsBeingUsed = true
return true
}
+1 -1
View File
@@ -252,7 +252,7 @@ class App: AppCenterApplication, NSApplicationDelegate {
func showUiOrCycleSelection(_ shortcutIndex: Int) {
debugPrint("showUiOrCycleSelection")
if isFirstSummon {
if isFirstSummon || shortcutIndex != self.shortcutIndex {
debugPrint("showUiOrCycleSelection: isFirstSummon")
isFirstSummon = false
if Windows.list.count == 0 || CGWindow.isMissionControlActive() { hideUi(); return }
@@ -178,8 +178,7 @@ class ControlsTab {
removeShortcutIfExists(controlId)
restrictModifiersOfHoldShortcut(controlId, [])
} else {
let i = controlId.hasPrefix("nextWindowShortcut") ? Preferences.nameToIndex(controlId) : nil
addShortcut(.down, controlId.hasPrefix("nextWindowShortcut") ? .global : .local, Shortcut(keyEquivalent: newValue)!, controlId, i)
addShortcut(.down, controlId.hasPrefix("nextWindowShortcut") ? .global : .local, Shortcut(keyEquivalent: newValue)!, controlId, nil)
restrictModifiersOfHoldShortcut(controlId, [(sender as! CustomRecorderControl).objectValue!.modifierFlags])
}
}