xbindkeys-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unable to define binding dynamically


From: Paul Dann
Subject: Unable to define binding dynamically
Date: Fri, 20 Dec 2019 10:22:36 +0000

It seems that in certain basic scenarios, bindings fail when defined dynamically:

(xbindkey-function "b:2"
  (lambda ()
    (xbindkey-function "b:1"
      (lambda ()
        (run-command "echo TRIGGER")))))

Pressing the middle button triggers the top-level binding, yielding the following debug output:

Button press !
e.xbutton.button=2
e.xbutton.state=16
"(Scheme function)"
    m:0x0 + b:2   (mouse)
got screen 0 for window 113
xbindkey_wrapper debug: key = b:1
add_key ok!!!  fun=1
Button release !
e.xbutton.button=2
e.xbutton.state=528

Note the "add_key ok", claiming that the inner binding was successfully defined. However, pressing the left mouse button yields nothing at all.

However, something interesting happens when an additional top-level binding exists:

(xbindkey-function "b:1"
  (lambda ()
    (run-command "echo BASE")))

(xbindkey-function "b:2"
  (lambda ()
    (remove-xbindkey "b:1")
    (xbindkey-function "b:1"
      (lambda ()
        (run-command "echo TRIGGER")))))

In this situation, pressing the left mouse button yields the "BASE" message as expected, and after clicking the middle mouse button, the "BASE" binding is correctly removed and replaced with the binding that yields "TRIGGER". From that point on, left-click yields the "TRIGGER" action, as expected.

So it seems that xbindkeys is unable to define bindings dynamically unless there was already a top-level binding defined for the button.

However, if the "BASE" binding is removed without defining a new "TRIGGER" binding, the left mouse button becomes non-responsive. It seems that the button is grabbed by xbindkeys, despite no binding being defined for the button.

I suspect xbindkeys is not working as intended, but I'd be really interested in an explanation if this is the intended behaviour.

Many thanks,
Paul

reply via email to

[Prev in Thread] Current Thread [Next in Thread]