evdevremapkeys icon indicating copy to clipboard operation
evdevremapkeys copied to clipboard

Allow loading arbitrary python modules

Open Lillecarl opened this issue 10 months ago • 0 comments

In this PR's current state I'm mainly gauging for interest in this feature, I'm maintaining my own remapper script right now (which I would still would do, but as an evdevremapkeys module instead).

Implements support for loading arbitrary python modules and calling functions on them when events fire.

Definitely don't merge this, it's very much just a WIP POC.

So what this does is allows you to configure a folder where we look for files, import them and add functions as "event hooks" so anyone who knows a little bit of Python can extend the functionality as they wish, limiting the scope of evdevremapkeys to a reasonable level while allowing "me" to do stuff like this monster

Ideas: Implement some common "event modules" for things like when capslock is held it's mapped to ctrl, when capslock is pressed quickly we send an escape key and allow these to be toggled per device ("Core evdevremapkeys modules" kinda)

TODO:

  • Create some kind of base class to inherit and override functions in for imports rather than "function pointers"
  • Make code nice
  • Add something to the build system that generates ".pyi" files for all keys and shit in evdev lib
  • Docs

Note: I'm very much still learning Python so don't be afraid to suggest anything and everything.

Lillecarl avatar Apr 12 '24 00:04 Lillecarl