#Python Hook API

1 messages · Page 1 of 1 (latest)

dapper relic
#

Python API which is allowed to attach a function / hook each key which would let one modify any aspect of the presses reported to the computer while they're being processed

keys here would be a dict of all keyboard keys structured like key_code: (position, is_actuated) e.g. KEY_RALT: 0.29333, True, some keys based on a filter
or even a single key

import wooting as wt

def my_hook(keys):
  ... # keys is mutable, you can have "is_actuated" on it to decide whether the system should recognize the key as pressed

def my_single_key_hook(position, rgb):
  ... # rgb is mutable, reported position is mutable, you can return True/False for actuation status

wt.hook_all_keys("my hook", my_hook)
wt.hook_filtered("my hook2", my_hook, [wt.R_ALT, wt.ENTER])
wt.hook_single("my hook3", my_single_key_hook, wt.R_ALT)

with code you could just do anything on any combination of keys in any position

any user devised functionality created out of analog positions of wooting keyboard keys could be done. if you also had control over all of the RGBs, like if e.g. the dict would instead be

key_code: (position, rgb, is_actuated)

you could also make some pretty amazing stuff using the RGB LEDs, I bet somebody would put doom on it

(sorry for hijacking, maybe this needs its own thread, but it's yet another functionality that could be done with the API)

Some points to consider:

  • users can easily learn python, it's one of the lowest-entry languages out there, and if they can't, they can ask an AI for help, it should be able to write simple scripts for them
  • users could share scripts
  • because python is interpreted, malicious code would be hard to hide
modern hatch
#

Sounds cool, im in!

sacred river
#

thats a normal... windows/unix event hook. python can already do that.

dapper relic
#

Can it grab key position though?

sacred river
#

yesnt. our sdks cant really do that either