1 | // TODO: ctrl etc |
2 | static bool onGlobalHotKey(S hotKey, fO r) { |
3 | if (empty(hotKey)) false; |
4 | final Int keyCode = mapGet(jNativeHook_keyCodes(), upper(hotKey)); |
5 | if (keyCode == null) ret false with print("Ignoring unknown hotkey: " + hotKey); |
6 | onGlobalKeyPress(voidfunc(NativeKeyEvent e) { |
7 | if (e.getKeyCode() == keyCode && e.getModifiers() == 0) |
8 | callF(r); |
9 | }); |
10 | print("Hotkey registered: " + hotKey); |
11 | true; |
12 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1015217 |
Snippet name: | onGlobalHotKey |
Eternal ID of this version: | #1015217/3 |
Text MD5: | 96c211deba234a0dc085e2af3cc5061b |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-19 19:51:20 |
Source code size: | 434 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 529 / 536 |
Version history: | 2 change(s) |
Referenced in: | [show references] |