You are not logged in.

#1 2018-06-03 23:32:46

d@nny_B0y2461995
Member
Registered: 2018-06-03
Posts: 1

Are mult-key hotkeys possible?

Hi all,
I am new to Arch Linux and am getting things set up for the first time smile  One thing that I can't seem to do is set up a hotkey combination with more then 2 hotkeys.  What I can currently do is add 

"<insert command here>"
     Alt + I

To my .xbindkeys.  What I would like to do is something along the lines of

"<insert command here>"
    Alt + I + d

This would let me have a whole slew of additional hot key combinations, but when I try to add this, the hot keys are ignored.  The output of

 xbindkeys -n 

shows

Please verify that there is not another program running
which captures one of the keys captured by xbindkeys.
It seems that there is a conflict, and xbindkeys can't
grab all the keys defined in its configuration file.

Which should't be a problem in this case.  Are there any suggestions on how this could be handled?  Thanks in advance!

Offline

#2 2018-06-03 23:53:10

circleface
Member
Registered: 2012-05-26
Posts: 639

Re: Are mult-key hotkeys possible?

What DE/WM are you using?

Offline

#3 2018-06-04 00:05:37

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,543
Website

Re: Are mult-key hotkeys possible?

Are you looking for key chains: press alt and I then d, or combinations pressing ald and I and d at the same time?

In either case, xbindkeys cannot do this.  In fact it's not trivial to do this at all under X11, but each are certainly possible with software designed specifically for that task.

The problem is most WMs/DEs or key binding tools call XGrabKey which requires a single keycode with an optional modifier mask.  Having multiple modifiers is easy as the masks are bitwise ORed together.  More importantly though, this is also how the events are reported to the software that requested the key grab.  So each event may indicate multiple modifiers (Mod4, Shift, Alt, etc) were pressed along with the non modifier key ('i' or 'd') but there could never be an event reporting for the two non-modifier keys at once.

So any logic to handle multiple non-modifier keys would have to be implented in the client program.  There's nothing actually that hard about it - I did it once for one version of a WM - but it ends up requiring a bit of code and some data structures that seem a bit bloated for a rare use case.  So most (i.e. all commonly used) key binding code does not try to do this.

Writing your own daemon for it would be a pretty good project to learn X11 coding though (assuming you know some C, or perhaps python already)

(edit: s/AND/OR/)

Last edited by Trilby (2018-06-04 01:40:23)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB