3

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

EDIT: Using Unity desktop.

5
  • 1
    xdotool click --repeat 2 1 bind this to b:2 with xbindkeys
    – PRATAP
    Dec 11, 2019 at 18:06
  • @PRATAP Using Unity desktop, forgot that. It's not working. I think it uses wayland and not X.
    – chila
    Dec 11, 2019 at 18:38
  • 1
    Hi, So in Ubuntu 18.04 you have installed Unity desktop? sudo apt install unity ??
    – PRATAP
    Dec 11, 2019 at 18:54
  • @PRATAP yes, that's correct.
    – chila
    Dec 11, 2019 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.
    – PRATAP
    Dec 11, 2019 at 19:20

2 Answers 2

5

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"
b:2

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.

       --clearmodifiers
           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


Workaround

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.

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

I've had little luck with btnx and xdotool so, if you're on Linux Mint or other Ubuntu-based distro, I would suggest input-remapper available on the repos:

sudo apt install input-remapper

Then, configure a desired button with the following code:

repeat(2, key(BTN_LEFT).w(50))

This will repeat the left button mouse with a 50ms delay. Using the standard key(BTN_LEFT).key(BTN_LEFT) did not worked for me, presumably because no ButtonRelease event was sent in time to be detected by cinnamon. Enjoy!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .