Skip to content

Commit

Permalink
feat(main): Don't repeat register shortcuts after retry failed
Browse files Browse the repository at this point in the history
  • Loading branch information
yinxin630 committed May 17, 2019
1 parent e8ecd7b commit 8e1046d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,16 @@ function createWindow() {
}
}

const registerHotkeys = (shortcuts) => {
const registerHotkeys = (shortcuts, isRetry = false) => {
// macOS. Loop check is trusted
if (isMac) {
const isTrusted = systemPreferences.isTrustedAccessibilityClient(false);
if (!isTrusted) {
setTimeout(() => registerHotkeys(shortcuts), 1000);
setTimeout(() => registerHotkeys(shortcuts, true), 1000);
// Don't repeat register shortcuts after retry failed
if (isRetry) {
return;
}
}
}

Expand Down

0 comments on commit 8e1046d

Please sign in to comment.