Skip to content
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

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
81de63a
first impl
EugeneP-Zello Jul 14, 2020
380153e
ios fixes
EugeneP-Zello Jul 15, 2020
91fe72a
macos fixes
EugeneP-Zello Jul 16, 2020
b7c8bab
code cleanup and formatting
EugeneP-Zello Jul 17, 2020
40f7671
prebuilds
EugeneP-Zello Jul 17, 2020
08d4d6c
update np
EugeneP-Zello Jul 17, 2020
3284e84
1.1.0
EugeneP-Zello Jul 17, 2020
db13346
add some logs
EugeneP-Zello Aug 5, 2020
2ca10a2
Merge branch 'feature/aggregate_iohook' of github.com:zelloptt/deskto…
EugeneP-Zello Aug 5, 2020
70ec00b
Merge branch 'feature/aggregate_iohook' of https://github.com/zellopt…
EugeneP-Zello Aug 5, 2020
2d85488
more logs
EugeneP-Zello Aug 5, 2020
c4a78ba
add some logs
EugeneP-Zello Aug 17, 2020
df6a8c8
first test
EugeneP-Zello Aug 17, 2020
a2aff60
update win prebuilds
EugeneP-Zello Aug 17, 2020
8865c0e
1.2.0
EugeneP-Zello Aug 17, 2020
8967367
upgrade dep
EugeneP-Zello Aug 24, 2020
7cd2695
1.2.1
EugeneP-Zello Aug 24, 2020
af055bb
update iohook ref
EugeneP-Zello Aug 24, 2020
058b88a
prebuilds
EugeneP-Zello Aug 24, 2020
443c7b6
update iohook ref
EugeneP-Zello Aug 24, 2020
b3b1010
1.2.2
EugeneP-Zello Aug 24, 2020
751c7c5
fix seq key assignment on mac
EugeneP-Zello Sep 1, 2020
13d6538
1.2.3
EugeneP-Zello Sep 1, 2020
e7cd035
add empty linux native impl
EugeneP-Zello Sep 11, 2020
3d49b6c
downgrade napi
EugeneP-Zello Sep 11, 2020
a3bc648
empty impl
EugeneP-Zello Sep 11, 2020
c401b58
1.3.0
EugeneP-Zello Sep 11, 2020
27c41eb
add dep
EugeneP-Zello Sep 11, 2020
b6f265e
1.3.1
EugeneP-Zello Sep 11, 2020
0c4eb22
use uiohook instead of iohook
EugeneP-Zello Sep 24, 2020
f4de2a8
specify branch for the submodule
EugeneP-Zello Sep 24, 2020
62eb16e
limit uiohook dep to mac-only
EugeneP-Zello Sep 24, 2020
ea69f0f
update win prebuilds
EugeneP-Zello Sep 24, 2020
5bb4035
1.4.0
EugeneP-Zello Sep 24, 2020
ea67833
add copy of libuiohook
EugeneP-Zello Sep 25, 2020
bdbcee6
1.4.1
EugeneP-Zello Sep 25, 2020
8f40dce
remove local copy of uiohook
EugeneP-Zello Sep 25, 2020
5249be8
1.4.2
EugeneP-Zello Sep 25, 2020
15530f3
do not track media keys
EugeneP-Zello Sep 30, 2020
f886950
Merge remote-tracking branch 'origin/mac_acc_perm' into mac_acc_perm
EugeneP-Zello Sep 30, 2020
21c64c9
do not track media keys
EugeneP-Zello Sep 30, 2020
c3402a0
update prebuilds
EugeneP-Zello Sep 30, 2020
f9480e0
update prebuild
EugeneP-Zello Sep 30, 2020
46b04f0
Merge branch 'mac_acc_perm' of https://github.com/zelloptt/globalhotk…
EugeneP-Zello Sep 30, 2020
72f01c6
1.4.3
EugeneP-Zello Sep 30, 2020
c7ca220
Update sample/sample.js
EugeneP-Zello Oct 9, 2020
c621643
code format, changes per cr
EugeneP-Zello Oct 9, 2020
13fa6d0
Merge remote-tracking branch 'origin/mac_acc_perm' into mac_acc_perm
EugeneP-Zello Oct 9, 2020
8c5a25c
cpp code formatting
EugeneP-Zello Oct 12, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitmodules
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
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/desktop-hotkeys.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 36 additions & 5 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,18 +1,49 @@

{
"targets": [{
"target_name": "desktop_hotkeys",
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
"sources": [
"src/main.cpp",
"src/Hotkeys.cpp",
"src/HotkeyManager.cpp",
],
"conditions":[
["OS=='mac'", {
"sources": [
"src/AddonMac.mm",
"src/AccessibilityMac.mm",
"src/HotkeysMac.mm",
"src/main.cpp"
],
'include_dirs': [
"libuiohook/include"
],
'libraries': [
"Release/uiohook.a"
],
'dependencies': [
"./uiohook.gyp:uiohook"
],
"cflags+": ["-fvisibility=hidden"],
"xcode_settings": {
"GCC_SYMBOLS_PRIVATE_EXTERN": "YES"
}
}],
["OS=='win'", {
"sources": [
"src/main.cpp",
"src/Hotkeys.cpp",
"src/HotkeyManager.cpp"
]
}],
["OS=='linux'", {
"sources": [
"src/main.cpp",
"src/HotkeysLinuxEmptyImpl.cpp"
]
}]
],
'include_dirs': [
"<!@(node -p \"require('node-addon-api').include\")"
],
'libraries': [],
'dependencies': [
"<!(node -p \"require('node-addon-api').gyp\")"
],
Expand Down
79 changes: 77 additions & 2 deletions index.js
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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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');
Copy link
Contributor

Choose a reason for hiding this comment

The 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') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check for this.macImpl instead?

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;

1 change: 1 addition & 0 deletions libuiohook
Submodule libuiohook added at 0134e6
Loading