October 17, 2021

[Note] New Keyboard and mouse - Linux middle mouse button emulation

This is a note on new keyboard and mouse I bought recently for my Linux desktop due to aging keyboard and mouse.

I've been using MS keyboard/mouse for many years (https://www.amazon.com/gp/product/B00CYX54C0/):


  • Most of key layout is great
  • Ergonomic
  • Perfect keyboard height and feeling of typing, quiet.


  • Small function keys
  • Strange layout of Insert/Del/Pg up-dn/Home/End keys.

I never got used to the mentioned keys as cons, and due to that, I always have to look at the keyboard for them.

Mouse is great, however, I like trackball for my wrist and shoulder over mouse, giving less stress on them.


I prefer keyboard with: 

  • normal size keys and layout for the mentioned keys.
  • non-bluetooth, wireless
  • no number keypad

These are what I bought:

Pros: It's the old standard style keyboard - I can do touch type for function keys and insert/del/home/pg up-dn keys easily.  

Cons: The key height is little too tall -- I like laptop like keyboard height and feeling better.

These days, many OS/apps use much less of function keys, but it's great for IDEs and customize them to do whatever the user needs are.

Everything is great, except that the location of buttons are a bit awkward, especially for the 2nd button.  It's too light, and can be pushed when clicking on buttons.  No 3rd button (middle button).

* * * * *

Note: emulating 3rd button


# Find device number
xinput list
# Inspect device properties
xinput list-props 9
# Turn on the emulator for middle button
sudo xinput set-prop 9 "libinput Middle Emulation Enabled" 1

This setting can be in ~/.xstartup.  
Here are a couple of other ways to set this, which I haven't tried:

[1] Modify xorg.conf
Section "InputDevice"
        Identifier      "Configured Mouse"
        Driver          "mouse"
        Option          "CorePointer"
        Option          "Device"                "/dev/input/mice"
        Option          "Protocol"              "ImPS/2"
        Option          "Emulate3Buttons"       "true"

[2] add in xorg.conf.d directory
Section "InputClass"
   Identifier "middle button"
   MatchIsPointer "on"
   MatchDriver "libinput"
   Option "MiddleEmulation" "on"

xorg.conf and xorg.conf.d are in /usr/share/X11/xorg.conf.d for my Ubuntu 20.01.