Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #1015217 // onGlobalHotKey

JavaX fragment (include)

// TODO: ctrl etc
static bool onGlobalHotKey(S hotKey, fO r) {
  if (empty(hotKey)) false;
  final Int keyCode = mapGet(jNativeHook_keyCodes(), upper(hotKey));
  if (keyCode == null) ret false with print("Ignoring unknown hotkey: " + hotKey);
  onGlobalKeyPress(voidfunc(NativeKeyEvent e) {
    if (e.getKeyCode() == keyCode && e.getModifiers() == 0)
      callF(r);
  });
  print("Hotkey registered: " + hotKey);
  true;
}

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: 450 / 461
Version history: 2 change(s)
Referenced in: [show references]