dakyskye / dxhd

daky's X11 Hotkey Daemon
MIT License
99 stars 6 forks source link

support for chord chains #8

Open dakyskye opened 4 years ago

dakyskye commented 4 years ago

chord chains should be exactly same as they are in sxhkd.

dakyskye commented 4 years ago

so, when we parse the config, we need to detect the event type for binding, that would introduce four new events: chord keypress, chord keyrelease, chord buttonpress, chord buttonrelease (probably). then, set relevant xevent events, and listen for EVERYTHING. Parser has to give us a map of string, containing arrays of string. Then, in the event listeners, we get what was pressed, if the map contains the keybinding, then, we set up a timer, passed as cmdline argument, and use the array of strings, which contain the next chords. if they match, we set up the timer again, and do that continuously unless we reach the last array index. Sounds easy to implement, parsing should also be easy.

However, my local tests did not satisfy me, since "listen for everything" did not work for RootWindow, but it worked for any existent window. As soon as I get it working for root win, chords gonna be implemented.

dakyskye commented 4 years ago

There is GrabKeyboard, SmartGrab and DumnyGrab functions, which seem to be what's needed for chord chains, but they GRAB the whole keyboard, which is just a joke, no whole keyboard grabbing gonna happen. However, the Connect methods for event structs has a parameter, to grab or not grab a keybinding. I am really wondering what happens when I do not grab a keybinding (tried it, I doubt it does anything, since it has no effect). Have to investigate.

erwin commented 2 years ago

I looked into this a bit in sxhkd and I don't think that listening for everything will work. I think that you've got to listen for every one of the possible keypresses that you may hit, individually.

dakyskye commented 2 years ago

Thanks for the interest and this investigation 👍 right now top priority is to rewrite dxhd because current codebase is horrible and once it's done I can look into getting chord chains supported.

Reikimann commented 2 years ago

What is the status on this feature?