-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mac acc perm #2
base: master
Are you sure you want to change the base?
Mac acc perm #2
Changes from 48 commits
81de63a
380153e
91fe72a
b7c8bab
40f7671
08d4d6c
3284e84
db13346
2ca10a2
70ec00b
2d85488
c4a78ba
df6a8c8
a2aff60
8865c0e
8967367
7cd2695
af055bb
058b88a
443c7b6
b3b1010
751c7c5
13d6538
e7cd035
3d49b6c
a3bc648
c401b58
27c41eb
b6f265e
0c4eb22
f4de2a8
62eb16e
ea69f0f
5bb4035
ea67833
bdbcee6
8f40dce
5249be8
15530f3
f886950
21c64c9
c3402a0
f9480e0
46b04f0
72f01c6
c7ca220
c621643
13fa6d0
8c5a25c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[submodule "libuiohook"] | ||
path = libuiohook | ||
url = https://github.com/zelloptt/libuiohook | ||
branch = 1.2 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,78 @@ | ||
var binding = require('node-gyp-build')(__dirname); | ||
module.exports = binding; | ||
class ShortcutHelper { | ||
constructor() { | ||
this.impl = require('node-gyp-build')(__dirname); | ||
if (process.platform === 'darwin') { | ||
this.macImpl = require('node-gyp-build')(__dirname); | ||
} | ||
} | ||
|
||
start(enableLogger) { | ||
return this.impl.start(enableLogger); | ||
} | ||
|
||
stop() { | ||
return this.impl.stop(); | ||
} | ||
|
||
reload() { | ||
this.impl.unregisterAllShortcuts(); | ||
this.impl.stop(); | ||
this.impl.start(false); | ||
} | ||
|
||
registerShortcut(keys, callback, releaseCallback, keysAreVKC) { | ||
return this.impl.registerShortcut(keys, callback, releaseCallback, keysAreVKC); | ||
} | ||
|
||
unregisterShortcut(shortcutId) { | ||
return this.impl.unregisterShortcut(shortcutId); | ||
} | ||
|
||
collectPressedKeyCodes() { | ||
console.log('\r\n(DHK) looking for pressed keys'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think this should be behind an interface of some kind |
||
if (process.platform === 'win32') { | ||
throw new TypeError('win32 impl does not track the keys'); | ||
} | ||
this.impl.collectPressedKeyCodes(true); | ||
} | ||
|
||
stopCollectingKeys() { | ||
this.impl.collectPressedKeyCodes(false); | ||
} | ||
|
||
pressedKeyCodes() { | ||
if (process.platform === 'win32') { | ||
throw new TypeError('win32 impl does not track the keys'); | ||
} | ||
const keyCodes = this.impl.pressedKeyCodes(); | ||
console.log('\r\n(DHK) Fetching the key codes [' + keyCodes + ']'); | ||
return keyCodes; | ||
} | ||
|
||
setupAccessibilityCallback(enable, cb) { | ||
if (process.platform === 'darwin') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check for |
||
if (enable) { | ||
return this.macImpl.macSubscribeAccessibilityUpdates(cb); | ||
} else { | ||
return this.macImpl.macUnsubscribeAccessibilityUpdates(); | ||
} | ||
} | ||
} | ||
|
||
showAccessibilitySettings() { | ||
if (process.platform === 'darwin') { | ||
this.macImpl.macShowAccessibilitySettings(); | ||
} | ||
} | ||
|
||
checkAccessibility() { | ||
if (process.platform === 'darwin') { | ||
return this.macImpl.macCheckAccessibilityGranted(); | ||
} | ||
return true; | ||
} | ||
} | ||
|
||
var shortcutHelper = new ShortcutHelper(); | ||
module.exports = shortcutHelper; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentations look off, should be 2 spaces per https://github.com/zelloptt/zello-code-style/tree/master/javascript#zello-javascript-code-style-and-standards