Program Ubuntu to ignore mouse clicks that are very close in time

In summary, the double click problem is caused by two click events being generated very close to each other. To fix the problem, local-overrides.quirksin /usr/share/libinput can be edited to change the value of MatchName to Logitech Wireless Receiver Mouse.
  • #1
Wrichik Basu
Science Advisor
Insights Author
Gold Member
2,119
2,692
At the very beginning, I accept that I have a faulty mouse. I bought it last year, and it's been only one year (almost), and the left button is malfunctioning. Single clicks are often becoming double clicks, which is causing a host of problems — closing two tabs one after the other in browsers, trying to select text moves a portion of selected text from one place to the other, difficulty in positioning the cursor, and so on. The easiest way forward would be to buy a new mouse, but we are currently going through a financial crunch and I would like to hold on to this mouse for a little longer. This is my third mouse, by the way, since I got the laptop two and a half years back.

The double click trouble is this: when I press and release the left button, two click events are generated almost one after the other, very close in time. It doesn't happen all the time, but very frequently, making it difficult for me to use the mouse, especially when I am doing some precision work like editing images.

Is it possible to write some program to instruct Ubuntu to ignore left button clicks that are generated very close to each other, say within 250 ms or something like that? The time interval is something that I have to play with and adjust, but where can I write the program to direct the system to do something like this? I am asking because there are programs like imwheel that can modify how many lines are scrolled each time I rotate the mouse wheel. Can something similar be implemented for my case?​
 
Computer science news on Phys.org
  • #2
Wrichik Basu said:
Is it possible to write some program to instruct Ubuntu to ignore left button clicks that are generated very close to each other, say within 250 ms or something like that?
This is called 'debouncing'. This is usually handled by libinput but getting the configuration right is a bit tricky. Search 'debounce mouse' in your favourite online forum for your distro.
 
  • Like
Likes jim mcnamara and Wrichik Basu
  • #4
Things just went to the next level: the double click problem created two threads, one after the other:

1643121758043.png


I got two notifications with the same thread name, one with @pbuk's reply, and one without it. Then saw the two threads had different ID: 1011641 and 1011642. :H
 
  • #5
We’ve been having double click issues too.
 
  • Wow
Likes Wrichik Basu
  • #7
jedishrfu said:
Unfortunately, that does not work in this case. As written in a comment to this answer on AskUbuntu,
That alters the acceptable delay between clicks that will be understood by Ubuntu as "double click" rather than 2 separate clicks. At best, this will affect what a second bounced click is interpreted as, but won't stop sending 2 clicks in the first place.
pbuk said:
This is called 'debouncing'. This is usually handled by libinput but getting the configuration right is a bit tricky. Search 'debounce mouse' in your favourite online forum for your distro.
Based on this and this question on AskUbuntu, I first found that libinput is not installed in my system. So, I installed it using sudo apt install libinput-tools. Then, I created a file local-overrides.quirksin /usr/share/libinput:
File local-overrides.quirks:
[Logitech Wireless Receiver Mouse]
MatchName=Logitech Wireless Receiver Mouse
ModelBouncingKeys=700
I changed the 700 from 4 to 7, 400, 700, rebooting each time. No change. The issue still persists.
 
  • #8
For a Logitech mouse you could try solaar.
 
  • Like
Likes jedishrfu
  • #9
If you can solder to a circuit board the best solution is to replace the mouse switches. I've done that several times with good results. The switches sell for less than USD $2 each here in the U.S. Of course shipping needs to be added.

If you do this you might as well replace all the switches at the same time, otherwise you will be taking the mouse apart three or four times as often!

( I use an optical mouse with a scroll wheel and replace switches about four times before the mechanical 'scroll' wears out.)

Cheers,
Tom
 
  • #10
pbuk said:
For a Logitech mouse you could try solaar.
Installed it, but it says that "No Logitech receiver found". I guess it doesn't work with my mouse.
Tom.G said:
If you can solder to a circuit board the best solution is to replace the mouse switches. I've done that several times with good results.
That might be the way out, other than buying a new mouse. I have loads of such switches at home, but currently I am miles from home, and won't be returning at least before February.
 
  • #11
I got that same issue with my Logitech mouse and solar on ubuntu and had to retire it in favor of the laptop trackpad..
 
  • Like
Likes Wrichik Basu
  • #12
I simply got a new mouse for Xmas when mine started doing this after about three years' use. It was the easiest solution.
 
  • #13
DrJohn said:
I simply got a new mouse for Xmas when mine started doing this after about three years' use. It was the easiest solution.
Yes, that is the easiest solution. However, as I wrote in the OP, I have a financial crunch in the family due to medical reasons, and we are trying to spend as little as possible on non-medical things. Since I am using Ubuntu, which allows the user to play with the OS files more than Windows, I thought there could be some way for solving this issue programmatically.
 
  • #14
Wrichik Basu said:
Since I am using Ubuntu, which allows the user to play with the OS files more than Windows, I thought there could be some way for solving this issue programmatically.
There probably is a way. I've never used Ubuntu or similiar, however if you post the mouse driver code, there may be someone lurking here that can supply some ideas. Switch debounce is a very common need, especially in lower-level software.

What say folks? Anyone adept at Ubuntu drivers?
 
  • #15
Tom.G said:
if you post the mouse driver code
Tell me how to get it.
 
  • #16
I think getting hold of the code is the easy part, the hard part will be relinking it into Wayland or whatever Ubuntu is using these days for display management and making sure upstream changes don't undo all the hard work. Seriously if you want to do this kind of thing then you don't want to be doing it with Ubuntu, you'd be better off with Arch.
 
  • #17
I googled on this phrase:
"alter bounce rate for a mouse in ubuntu" and the first answer suggested a way, if you haven't tried this. But I don't use ubuntu so can't test it.

It said "If you type synclient you have some parameters such as MinSpeed, MaxSpeed & AccelFactor that you can play with. "

PS so I had another reply under my name today, where I must have clicked while moving the mouse!
 
  • #18
Wrichik Basu said:
I first found that libinput is not installed in my system.
I think you will find that it is.

Wrichik Basu said:
So, I installed it using sudo apt install libinput-tools.
As the name implies that is some tools for helping with development and debugging libinput, not libinput itself. Uninstall it (unless you are going to delve into hacking libinput of course).

Wrichik Basu said:
Then, I created a file local-overrides.quirksin /usr/share/libinput:
I don't think you wanted to do that. See https://wayland.freedesktop.org/lib...html#installing-temporary-local-device-quirks

Don't expect changing settings in ini files to work first time, you are going to have to experiment with a LOT of things because any reference you read may not refer to the same device/compositor/libinput/version etc. as you have.

Also, Ubuntu LTS is quite old now, you might find a difference on 21.10 if you can try installing that on a spare partition.
 
  • #19
Wouldn't it just be easier to buy a new mouse? I mean the trouble you're going through just to sort it out ... - plane @ simple
Go to the local computer shop and buy it second hand if you're that strap on cash.
 
  • #20
First, sorry for the very late reply. Was really busy elsewhere and didn't get time to come back and type a reply.
pbuk said:
As the name implies that is some tools for helping with development and debugging libinput, not libinput itself. Uninstall it (unless you are going to delve into hacking libinput of course).
When I tried to execute libinput list-devices | grep Device, Ubuntu said, "Command 'libinput' not found", and recommended the package libinput-tools for this to work, which is why I had installed it. Uninstalled it as you said.
pbuk said:
Hmm, okay. This answer on AskUbuntu says I should put it under /usr/share/libinput which is what I had followed. In the page you linked, it states I should put the file under /etc/libinput/local-overrides.quirks Will follow that.
pbuk said:
Don't expect changing settings in ini files to work first time, you are going to have to experiment with a LOT of things because any reference you read may not refer to the same device/compositor/libinput/version etc. as you have.
Yeah, I know. The worst part is I have to restart the machine every time for the changes to be applied, which makes it irritating.
pbuk said:
Also, Ubuntu LTS is quite old now, you might find a difference on 21.10 if you can try installing that on a spare partition.
Since this is my everyday-use laptop, I will probably wait till the next LTS this year, try it out on VirtualBox to see that everything works fine, and then upgrade.
 
  • #21
I don't have the same distro so it won't be the same tools, but I had the same problem. I solved it by searching "accessibility" (shaking hands) tools. My hands are not shaking, but my mouse behaved as if they were. Not any more.
 
  • Like
Likes Wrichik Basu
  • #22
Wrichik Basu said:
The easiest way forward would be to buy a new mouse, but we are currently going through a financial crunch and I would like to hold on to this mouse for a little longer.
The best mouse I own cost $12. I got rid of a razor hex, because while I liked the design, the drivers were crap, and needed to be updated every week for no obvious reason.

Time spent on this fix you want to write would likely earn you more then $12 if you used it in some more productive manor.
 
  • Love
  • Skeptical
Likes Wrichik Basu and Tom.G

Related to Program Ubuntu to ignore mouse clicks that are very close in time

1. What is Ubuntu?

Ubuntu is a popular open-source operating system based on the Linux kernel. It is widely used for personal computers, servers, and other devices.

2. How can I program Ubuntu to ignore mouse clicks?

To program Ubuntu to ignore mouse clicks, you can use the xinput command in the terminal. This command allows you to manage input devices, including the mouse. You can disable the mouse clicks by using the "disable" option for the specific input device.

3. Why would I want to ignore mouse clicks?

Ignoring mouse clicks can be useful in certain situations, such as when you are giving a presentation or recording your screen, and you do not want accidental clicks to disrupt your work. It can also be helpful for individuals with disabilities who may have trouble with precise clicking.

4. How can I specify the time interval for ignoring mouse clicks?

You can specify the time interval for ignoring mouse clicks by using the "delay" option with the xinput command. This allows you to set a specific delay (in milliseconds) before the mouse clicks are registered again.

5. Is there a graphical interface for programming Ubuntu to ignore mouse clicks?

Yes, there are several graphical interfaces available for managing input devices in Ubuntu, such as the GNOME Tweaks tool or the xinput-gui application. These interfaces provide a more user-friendly way to disable mouse clicks and adjust the delay time.

Similar threads

Replies
1
Views
46
  • Computing and Technology
5
Replies
151
Views
12K
  • Computing and Technology
Replies
14
Views
2K
  • Computing and Technology
Replies
8
Views
3K
  • Computing and Technology
Replies
10
Views
5K
  • Computing and Technology
Replies
3
Views
509
  • Computing and Technology
Replies
2
Views
750
  • Computing and Technology
Replies
9
Views
2K
  • Computing and Technology
Replies
1
Views
908
Replies
4
Views
1K
Back
Top