fix: potentially fix shortcuts not working sometimes

Also potentially fixed crashes as some shortcuts would execute code that should run on the main thread, from other threads
This commit is contained in:
Louis Pontoise authored and lwouis committed 2020-05-26 02:29:25 +09:00
1 parent fa1095e83c
commit 8d833f5163
1 file changed
+1 -7
@@ -88,13 +88,7 @@ class GeneralTab: NSViewController, PreferencePane {
App.app.appIsBeingUsed = false
App.app.isFirstSummon = true
}
let fn = shortcutsActionsBlocks[controlId]!
let isShortcutAffectingTheUi = ["previousWindowShortcut", "nextWindowShortcut", "←", "→", "↑", "↓", "holdShortcut"].contains(controlId)
if isShortcutAffectingTheUi || isShortcutClosingTheUi {
DispatchQueue.main.async { () -> () in fn() }
} else {
fn()
}
DispatchQueue.main.async { () -> () in shortcutsActionsBlocks[controlId]!() }
}
return true
})