You are not logged in.

#1 2018-08-24 11:55:55

jeroen_JDOG
Member
Registered: 2015-03-28
Posts: 19

Rebind extra mouse buttons

I currently have a Trust Evo Advanced wireless mouse, which has some extra buttons. A "windows" button and a "zoom" button. These worked out of the box on Arch Linux, being bound to the windows and ctrl keys respectively. But I was wondering if I could somehow rebind these buttons to other key combinations, such that I can use them in Openbox's rc.xml to bind bash commands to them.

I found that the regular mouse buttons are registered in /dev/input/event5, while the two extra buttons are registered in /dev/input/event3. There the extra buttons give the following events (I'm pressing and release the windows key, and then pressing and releasing the zoom key).

Event: time 1535101633.370696, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
Event: time 1535101633.370696, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 1
Event: time 1535101633.370696, -------------- SYN_REPORT ------------
Event: time 1535101633.498699, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
Event: time 1535101633.498699, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 0
Event: time 1535101633.498699, -------------- SYN_REPORT ------------
Event: time 1535101634.322720, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1535101634.322720, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1535101634.322720, -------------- SYN_REPORT ------------
Event: time 1535101634.482724, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1535101634.482724, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 0
Event: time 1535101634.482724, -------------- SYN_REPORT ------------

Is there any way to rebind these two keys, such that I can bind a bash command to them?

Offline

#2 2018-08-24 13:04:28

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Rebind extra mouse buttons

Does xev show their button numbers? Then, can use openbox bindings.

Offline

#3 2018-08-24 13:50:42

jeroen_JDOG
Member
Registered: 2015-03-28
Posts: 19

Re: Rebind extra mouse buttons

These are the events that xev shows when pressing the windows button on the mouse:

KeyPress event, serial 50, synthetic NO, window 0x1e00001,
    root 0x6c2, subw 0x1e00002, time 17531878, (47,35), root:(1968,861),
    state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 50, synthetic NO, window 0x1e00001,
    root 0x6c2, subw 0x1e00002, time 17532006, (47,35), root:(1968,861),
    state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

I don't know if you mean and actual "button number" entry, but it only shows "keycode 133 (keysym 0xffeb, Super_L)".
Super_L is the windows key (same as on the keyboard), so I think this already registers it incorrectly.
To clarify, I want the windows button on my mouse to have different functionality than the windows button on the keyboard.

I started working on a bash program to try to get something working.
It listens to /dev/input/event3, and runs a bash command whenever it receives a keypress there.
Then I will create a systemd script to keep this running, and it should work.
It isn't the best solution though, so I'm still hoping to find some way to rebind the mouse buttons.

Last edited by jeroen_JDOG (2018-08-24 13:52:49)

Offline

#4 2018-08-24 14:22:01

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,257

Re: Rebind extra mouse buttons

The device likely shows up as mouse and keyboard (see "xinput")
In that case, you could write a custom xkbmap and match it by product/vendor using a dedicated "InputClass" configlet for xorg.

https://wiki.archlinux.org/index.php/X_ … c_examples

Section "InputClass"
    Identifier          "Mouseboard"
    MatchIsKeyboard	"yes"
    MatchProduct "the product as listed in xinput"
    Option	        "XkbLayout" "yourlayout"
EndSection

Offline

Board footer

Powered by FluxBB