Mouse double-click min interval

6,366

Solution 1

What you are looking for is a software debouncer.

There are two AutoHotkey solutions for Windows in this thread.

The first is a short script from a user named HotKeyIt:

LButton::   
    If (A_TimeSincePriorHotkey < 150) ;hyperclick
        Return
    Click Down
    KeyWait, LButton
    Click Up
Return

And then there's a longer solution: Buggy-Mouse.ahk - Fix a buggy mouse. Stop it from double-clicking when you try to single-click.

As for Linux, you might try using IronAHK, a port of AutoHotkey for platforms with Mono support, though I'm not sure of its capabilities.

Solution 2

For linux solution: http://blog.guntram.de/?p=16

It may work in every distro if you recompile evdev and apply the patch. Below is extracted from that link:

  • Get event-debounce-patch, either by copy/pasting from the original author post, or from my mirror.

  • Install the source code of evdev and the build environment, and compile it. Warning: the first apt-get will install the source to a subdirectory of your current directory, so cd to something suitable first.

    apt-get source xserver-xorg-input-evdev-dev
    sudo apt-get build-dep xserver-xorg-input-evdev-dev
    cd xserver-xorg-input-evdev-2.8.2/
    patch -p 1 < ../evdev-debounce.patch
    dch -i
    debuild -us -uc -b
    cd ..
    
  • This will give you a file named xserver-xorg-input-evdev_2.8.2-1ubuntu2_amd64.deb in the directory you started from. Or, x86 instead if amd64 if you’re on a 32 bit system. In case you don’t want to compile yourself, you can download the file from my mirror. This is for Ubuntu 14.04, so depending on when you read this, my file will be outdated and you have to build it yourself.

  • Install this .deb file using

    sudo dpkg -i xserver-xorg-input-evdev_2.8.2-1ubuntu2_amd64.deb
    
  • Now, log out and re-login; this should start the X server and load the new package.

  • Next is to configure debouncing; unconfigured, the new software doesn’t change anything. Use xinput –list to find out the ID of your mouse device – in my case it’s the Razer mouse, ID=10:

    $ xinput --list
     ⎡ Virtual core pointer id=2 [master pointer (3)]
     ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
     ⎜ ↳ Razer Razer Copperhead Laser Mouse id=10 [slave pointer (2)]
     ⎣ Virtual core keyboard id=3 [master keyboard (2)]
     ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
     ....
    
  • When you know your mouse device id, list the properties of that device. One of the properties – typically the last one – is the new debounce delay. You’ll need its id (286 in this case):

    $ xinput --list-props 10
     .....
     Evdev Debounce Delay (286): 0
     .....
    
  • Last, change the property to the maximum value to debounce. If you set this too high, a fast real double-click might be “debounced” as well – a value of 20 works well for me, if your mouse switches are worn out badly, you might want to use 50:

    $ xinput --set-prop --type=int --format=32 10 286 20
    
  • Once you find a value you like, you can put the above command into your $HOME/.xprofile. Or, to install a system-wide configuration file, put the following into /usr/share/X11/xorg.conf.d/12-evdev-debounce.conf – this file is new, and you need to be root to write it:

    Section "InputClass"
     Identifier "evdev pointer debounce"
     MatchIsPointer "on"
     MatchDriver "evdev"
     Option "DebounceDelay" "20"
     EndSection
    
Share:
6,366

Related videos on Youtube

Anonymous
Author by

Anonymous

Updated on September 18, 2022

Comments

  • Anonymous
    Anonymous almost 2 years

    This is the second mouse dying on me because of a poor switch ! Under most operating systems there is a option to set the max time interval in which two mouse clicks are processed as on double click.

    Logically there has to be a way to set a minimum double click time interval!

    I surely could replace the broken switch but there are costs for the new switch, time and basic soldering needed for that. Obviously this should be the last possible step to take.

    Firstly I want to try to let the computer handle the broken mouse. I am searching a fix for windows and especially for linux (ubuntu) systems.

    E: as Matt Eckert mentioned the problem is that the mouse switch is gotten loose and is producing two signals with just one key press. I've never mentioned that I want to set up anything within th mouse. Sorry for the misunderstanding, I thought that this problem occurs very often so that everyone understands the problem with the give information.

    Under Windows there is only the option to set the maximum time interval in in which a double click is recognized. I need to set up the minimum time interval. In other word a double click should only be recognized if the time difference between two mouse clicks is at least for example half of a millisecond.

    • cutrightjm
      cutrightjm over 11 years
      A poor switch as in it won't click? You set double-click time intervals on the OS, not via the mouse. In Windows open up the control panel and click 'Mouse' to adjust the settings.
    • Matt Eckert
      Matt Eckert over 11 years
      @ekaj I think the problem is the mouse is sending two clicks very rapidly when clicking just once.
    • Neil Stockbridge
      Neil Stockbridge about 5 years
      I fixed the same problem with my mouse buttons like this (YouTube)
  • Anonymous
    Anonymous over 11 years
    Thanks! The ahk script did solved the problem on windows but I am still searching for a solution for ubuntu.
  • Matt Eckert
    Matt Eckert over 11 years
    @Anonymous did you try IronAHK? I'm curious as to whether it can handle this.
  • Tetsujin
    Tetsujin over 9 years
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
  • undefined
    undefined over 3 years
    Copy/paste what from that page? It looks like a git commit and a diff. The mirror is a link to a .patch file. What do I do with that?