Ubuntu 18.04. When I click the middle mouse button, it should double click. Thanks.

EDIT: Using Unity desktop.

  • 1
    xdotool click --repeat 2 1 bind this to b:2 with xbindkeys – UnKNOWn Dec 11 '19 at 18:06
  • @PRATAP Using Unity desktop, forgot that. It's not working. I think it uses wayland and not X. – chila Dec 11 '19 at 18:38
  • 1
    Hi, So in Ubuntu 18.04 you have installed Unity desktop? sudo apt install unity ?? – UnKNOWn Dec 11 '19 at 18:54
  • @PRATAP yes, that's correct. – chila Dec 11 '19 at 18:55
  • 1
    I have installed unity with sudo apt install unity and it is xsession only not wayland. I have tried xdotool click --repeat 2 1 binding it with letter p for testing purpose with xbindkeys and it worked. for b:2 I need to dig.. but unfortunetly I dont have external mice and my laptop touchpad tap to clicks are not working at all with unity. – UnKNOWn Dec 11 '19 at 19:20

OS: Ubuntu 18:04
Required Packages: xdotool and xbindkeys

you can install these packages with sudo apt install xdotool xbindkeys

gedit .xbindkeysrc

Paste the below content

"xdotool click --repeat 2 1"

Save the file and run xbindkeys --poll-rc

now your Middle Click should work as double click.

from man xdotool some of the content

   click [options] button
       Send a click, that is, a mousedown followed by mouseup for the
       given button with a short delay between the two (currently 12ms).

       Buttons generally map this way: Left mouse is 1, middle is 2, right
       is 3, wheel up is 4, wheel down is 5.

           Clear modifiers before clicking. See CLEARMODIFIERS below.

       --repeat REPEAT
           Specify how many times to click. Default is 1. For a double-
           click, use '--repeat 2'

Tested on Ubuntu 18.04.3


If you have installed unity like this sudo apt install unity

then use below content in .xbindkeysrc file

"xdotool click --repeat 2 1"
b:2 + Release

Tested on Ubuntu 18.04 with Unity session.

  • Using Unity desktop, forgot that. It's not working. I think it uses wayland and not X. – chila Dec 11 '19 at 18:38
  • 1
    @Chila Answer Edited. Please Review. – UnKNOWn Dec 11 '19 at 19:50
  • Works. Too bad is on release, the mouse must be steady. – chila Dec 12 '19 at 16:41
  • Great! It works on Ubuntu Budgie 20.04. – facetus Jul 5 '20 at 0:27

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.