2

The middle click button of the mouse I use is broken, so I'd like to simulate it by pressing left and right mouse buttons at the same time.

In Freya, I could do:

xinput set-prop "Wireless Optical Mouse" "Evdev Middle Button Emulation" 1

But in Loki, I get this message:

property 'Evdev Middle Button Emulation' doesn't exist, you need to specify its type and format

I'd like the simulation to persist across reboots and suspends.

  • Another question would be: How to simulate middle click on a notebook touchpad? – Bhikkhu Subhuti Feb 12 '17 at 11:22
2

I got this working. Firstly I needed to change the property name. Then I could use that with the xinput command inside ~/.profile. Thanks to this Unix Stackexchange answer, I am able to execute the xinput command after each unlock.

Here's what I added to my ~/.profile:

simulate_mouse_middle() {
    xinput set-prop "Wireless Optical Mouse" "libinput Middle Emulation Enabled" 1
}

simulate_mouse_middle

dbus-monitor --session "type='signal',interface='com.ubuntu.Upstart0_6'" | \
(
    while true; do
        read X
        if echo $X | grep "desktop-unlock" &> /dev/null; then
            simulate_mouse_middle
        fi
     done
) &

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.