DEV Community

Brama Udi
Brama Udi

Posted on • Edited on

2 2

Enabling Mouse Middle Click Emulation in Linux

What i mean about "Middle Click Emulation"? Hmm, this is like a feature that allow you to emulate a middle click when pressing left and right buttons simultaneously, really good if you hate/have broken mouse wheel click.

As i remember some Linux like "Linux Mint" enable it by default, but if you try on your current Linux OS and it doesn't work then follow these step to enable.

Prerequisite

  • xinput installed, i.e. if you are on Debian you can install it with apt package manager when don't have it, apt-get install xinput.

Steps

1.) Find your mouse device ID

xinput
Enter fullscreen mode Exit fullscreen mode

In my case the mouse ID are 8

xinput output

2.) Find mouse "emulate" props ID

xinput list-props 8
Enter fullscreen mode Exit fullscreen mode

In result above we've found props ID for Emulate Middle Click is 265 and they still have a 0 value.

xinput-list-props

3.) To enable it lets change the Emulate Middle Click value to 1

xinput set-prop 8 265 1
Enter fullscreen mode Exit fullscreen mode

xinput-set-prop

Thats all, you can place the last command xinput set-prop 8 265 1 to $HOME/.profile or $HOME/.bashrc file for persistent changes after reboot.


UPDATE: Recently i use GNOME desktop environment and use Wayland session, the xinput's result keep showing me some virtual devices like this

Wayland xinput result

... and of course make the tutorial above is meaningless, then the solution here is just paste the command below:

gsettings set org.gnome.desktop.peripherals.mouse middle-click-emulation true
Enter fullscreen mode Exit fullscreen mode

Reference:

libinput-force-middle-click-emulation

Heroku

Deploy with ease. Manage efficiently. Scale faster.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Dive into this thoughtful article, cherished within the supportive DEV Community. Coders of every background are encouraged to share and grow our collective expertise.

A genuine "thank you" can brighten someone’s day—drop your appreciation in the comments below!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found value here? A quick thank you to the author makes a big difference.

Okay