PixlOne / logiops

An unofficial userspace driver for HID++ Logitech devices
GNU General Public License v3.0
3.38k stars 270 forks source link

Gesture button chords? #69

Open jimduchek opened 4 years ago

jimduchek commented 4 years ago

Just got an MX Master 3 today. On my previous MX Performance, the 'gesture' button appeared as a separate 'normal' mouse button (just like any other) and I had an xbindkeys setup that allowed me to do 'chords' -- hold the gesture button then click the left or right button to do stuff. Kinda got used to it. Would such a thing be possible here? Happy to dig into the code and and possibly do a PR if the answer is "yes" or "I don't know", but if you happen to know it's not possible I can save myself the effort.

rosshadden commented 4 years ago

Yes you can map the gesture button to a "normal" button/key. This is what I do to get chords working, since they aren't supported first-class by logiops or piper:

# logid.cfg
{ cid: 0xc3; action = { type: "Keypress"; keys: ["KEY_HANJA"];    }; }

# .Xmodmap
keycode 131 = Hyper_L
remove Mod4 = Hyper_L
add Mod3 = Hyper_L

# sxhkdrc
hyper + {button1,button6,button7}
    playerctl {play-pause,next,previous}

hyper + {button2,button3,button4,button5}
    ~/dotfiles/bin/config {volume !, mic !, volume +5,volume -5}

This makes the gesture button register as HYPER_L, and I then map the following (some abstracted by some script I wrote):

rosshadden commented 4 years ago

The above answers the question in your title. To answer the description in your title more specifically, the KEY_HANJA is the "normal" key in this case. You can make it things like KEY_A or BTN_LEFT for example, but I skipped a step and explained my workflow for chording based on your question.

I actually didn't have this setup until I read this issue you posted which gave me the hint of using xbindkeys (I used xmodmap instead, but same idea). So ironically you helped me help you :D. Thanks!