Middle button emulation using keyboard and left click?

decuser

Active Member

Reaction score: 74
Messages: 216

I am setting up a laptop (Ideapad Y500) and it only has a trackpad with two buttons. The trackpad is pretty clunky (I'm used to my T430 and Macbook). I am nearly unable to use it in 3 button emulated mode - clicking left and right on it at the same time is pretty tricky. Is there a way to get X to allow me to just Ctrl-Click for right click and Super-Click for middle click, or something similar?
 

memreflect

Active Member

Reaction score: 169
Messages: 189

If your touchpad device doesn't allow multi-touch tapping to generate the appropriate action, or it's simply inconvenient to use multiple fingers to perform the correct action, then I'd create a solution combining a hotkey daemon like x11/sxhkd with xte(1) from x11/xautomation (credit to sxhkd on the Arch Wiki for the idea). Example ~/.config/sxhkd/sxhkdrc config file based on the official docs:
Code:
# Ctrl + Left-press => Right-click
ctrl + button1
    xte "mouseclick 3"

# Super + Left-release => Middle-click
super + @button1
    xte "mouseclick 2"

It's worth mentioning that sxhkd is actually just a normal X11 application that runs in the background, not a service to enable in rc.conf(5) the way that something like sshd(8) is.
 

Mjölnir

Daemon

Reaction score: 1,463
Messages: 2,114

Ask 20-100-2fe (e.g. forum's conversation facility), he's got an IdeaPad, too (maybe a slightly different model). He wrote it's not synaptics(4), and uses the I2C bus, so that thingy seems to be kind of special. Maybe he found out about middle-button emulation.
 
Top