xbindkeys-devel
[Top][All Lists]
Advanced

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

Re: [Xbindkeys-devel] Undocumented mouseclick/mousebutton modifiers?


From: Mark Lawson
Subject: Re: [Xbindkeys-devel] Undocumented mouseclick/mousebutton modifiers?
Date: Fri, 25 Nov 2016 16:04:40 -0800

No problem Eugene. I think that this is just currently a limitation (bug perhaps?) in xbindkeys.

However, I was able to create a hack workaround -- not using xbindkeys -- but I wanted to add this workaround to the mailing list, to help out people searching the issue of mouse buttons not working when other mouse buttons are clicked (or modifiers are set) in the future. This workaround can work in conjunction with xbindkeys.

This simple script did the trick for me -- I'm not much of a scripter, so it could be written a lot better, but it works:

#!/bin/bash
xinput test 9 | while read LOGLINE
do
        if [ "${LOGLINE}" == "button press   9" ]; then #forward mouse button click on my mouse
                # execute any script or command here
        fi
done

Of course, unlike using xbindkeys, the forward mouse button still performs the usual function -- so it does whatever it was going to do, plus executing the script/command.

I got the number 9 for the xinput on the first line by running "xinput -list" and finding my mouse as number 9. "xinput -test 9" simply displays (all?) input from that device, in this case, including mouse movements. This is how I got the string to check against, by pressing down the desired mouse button with this running.

I hope this helps someone in the future, and thank you Eugene for all the help along the way!

-Mark


On Thu, Nov 24, 2016 at 11:28 PM, Eugene Pakhomov <address@hidden> wrote:
Sorry, at this point I have no idea why it doesn't work.
You can try to either debug or cram a bunch of print statements somewhere in this "case": https://github.com/p-himik/xbindkeys/blob/4aefb3536a15ff0d6a434987358a94e210c2b4ce/xbindkeys.c#L376
As far as I recall, in Qt framework mouse events have not only "button" field, but also "buttons" that should be used exactly when you try to press multiple buttons. Maybe in the case of XEvent it's something similar.

Eugene


On Fri, Nov 25, 2016 at 2:16 PM, Mark Lawson <address@hidden> wrote:
Hey Eugene,

Haha, my bad, yes I see what you meant now :)

Unfortunately, when I have:

;; test
(xbindkey (list allmods "b:1" "b:8") "test_script")

The script does not fire, in any case. Pressing b:1 down, then b:8 does not work, nor does any other combination I could think of. b:1 or b:8 by themselves do not trigger it, either.

I did try looking in xev again, and saw this:

b:8 pressed down by itself:

ButtonPress event, serial 38, synthetic NO, window 0xc600001,
    root 0x29b, subw 0xc600002, time 1759241354, (45,41), root:(530,442),
    state 0x0, button 8, same_screen YES

b:1 pressed down, and then b:8 pressed down (only showing the ButtonPress event for b:8 being pressed):

ButtonPress event, serial 38, synthetic NO, window 0xc600001,
    root 0x29b, subw 0xc600002, time 1759231093, (45,41), root:(530,442),
    state 0x100, button 8, same_screen YES

I'm not sure if that is a good lead on anything right there though. Since that "state" is represented by m:32768, I would expect it to cover 0x100.

Thanks,

Kevin



On Thu, Nov 24, 2016 at 10:17 PM, Eugene Pakhomov <address@hidden> wrote:
I got that the first time. :)

What I meant is - what happens when you use '(list allmods "b:1" "b:8")'? Does it trigger "test_script" when you simultaneously press b:1 and b:8?
If yes, it's pretty easy to write a function that would create all alternative mappings for a particular button.

Eugene


On Fri, Nov 25, 2016 at 1:13 PM, Mark Lawson <address@hidden> wrote:
Hi Eugene,

Understood.

As for the command -- the following worked in the cases of control, alt, and shift being pressed down, but not with "b:1" pressed down, or "b:3" pressed down:

;; test
(xbindkey (list allmods "b:8") "test_script")

So, to be clear, the above works in all cases other than when "b:1" or "b:3" is pressed down at the time "b:8" is pressed down.

I hope I explained that correctly -- please let me know if I'm not being clear enough.

Thanks,

Mark




On Thu, Nov 24, 2016 at 8:56 PM, Eugene Pakhomov <address@hidden> wrote:
Removing xbindkeys-devel, since I think it's not really related to the channel.

I don't think you need "+" in that (list...). Can you try without it?

Eugene


On Fri, Nov 25, 2016 at 2:54 AM, Mark Lawson <address@hidden> wrote:
Forgot to reply all -- my mistake :) Thanks again for the help.

On Thu, Nov 24, 2016 at 11:35 AM, Mark Lawson <address@hidden> wrote:
Hi Eugene,

Thanks for the quick response! I believe that this has solved half of the problem. Using this fork, and the exact same command structure that you listed, my "b:8" key works just fine with the control, shift, and alt modifiers pressed down now.

However, "allmods" does not seem to be covering the mouseclick modifiers, still. So, if I press down right click, and then press "b:8", the script does not fire.

I tried to do the following, but had no luck, trying to get "b:8" to trigger the script when "b:3" is pressed down already:

(define allmods "m:32768")

;; test
(xbindkey (list allmods "b:8" + "b:3") "test_script")

Here "b:3" is my right click, but I had no luck with this. I couldn't get the script to fire in any situation with this line of configuration.

Any thoughts?

Thank you,

Mark




On Thu, Nov 24, 2016 at 6:59 AM, Eugene Pakhomov <address@hidden> wrote:
Hi Mark,

Could you please check if this fork works for you? https://github.com/p-himik/xbindkeys
I've sent a PR awhile back, but apparently it didn't make it.

In your config, you'd need to use "AnyModifier".
E.g. I have these lines in my ~/.xbindkeysrc.scm:

(define allmods "m:32768")

(xbindkey (list allmods "b:9") "xte 'keydown Control_L' 'key Insert' 'key Insert' 'keyup Control_L'")
(xbindkey (list allmods "b:8") "echo 'cycle pause' | socat - /tmp/mpvsocket")

Regards,
Eugene


On Thu, Nov 24, 2016 at 12:10 PM, Mark Lawson <address@hidden> wrote:
Hello everyone,

So far, xbindkeys has always met all my needs. However, I believe that the mouseclick modifiers may not be documented, and more importantly, that they are not recognized when used in the xbindkeysrc file.

My use case is simple: I am binding the forward button of my Logitech G400s mouse to a new action. All that you would expect would be required is right here:

"my_script args"
  b:9

It works as expected in most conditions. However, if the left click button is also pressed down, and is still held down when I press the forward button, the script does not fire.

"xbindkeys -k" does not recognize forward mouse buttons, though I did notice that when I have the left click button pressed, and then press a normal key (like 'r'), this output is generated:

$ xbindkeys -k
"(Scheme function)"
    m:0x100 + c:27
    r

Whereas for a normal 'r' press, it is simply "m:0x0".

When the same thing, but with right click pressed down, I get "m:0x400". Left and right both pressed down, predictably, makes "m:0x500".

However, I was not able to get any of these modifiers to be respected. First, I tried changing the associated key to "b:9 + b:1", but that would only fire immediately upon b:1 being pressed down; b:9 didnt work at all here.

Then, I tried to use "m:0x100 + b:9", however, that did not work either.

The only (english) reference I could find online to the most basic "m:0x100" modifier was this:
https://github.com/Zren/WindowsToLinux/blob/master/home/chris/.xbindkeysrc

Which seems to imply that it is the same thing as "b:1". But I would imagine that "b:1" is the button itself, whereas "m:0x100" is the state of the mouse at the time some other button is pressed down.

Any suggestions? My ultimate goal is for this forward mouse button to trigger my script regardless of whether or not the left or right click buttons are pressed down at the time I hit the forward button.

Thanks for reading!

-Mark










reply via email to

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