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? Feb 12, 2017 at 11:22

1 Answer 1


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


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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