6

Just got a new mouse (glorious model o) and I can get double clicks on it (I click once, get two clicks) however I can only get it to register two clicks on windows. I've done some research and I'm pretty sure that it is libinput preventing double clicks by default. Is there any way to make it so that it doesn't try to cancel the double clicks? I know for most people preventing double clicks is useful however I want to be able to double click to get higher CPS in Minecraft and I never manage to accidentally get a double click.

Eliah Kagan
  • 117,780
Custard
  • 73
  • 1
  • 6
  • If you're confident that debounce is the reason for this, you should report a bug. There's not much sense in working it around locally, since someone else may stumble upon the same problem. Make sure you tested with latest libinput before doing so though. – Hi-Angel Jan 01 '20 at 11:32
  • For most people double clicks only occur on broken hardware and libinput trys to prevent that from happening, which isn't a bug. However I don't want it to prevent them. – Custard Jan 01 '20 at 11:40
  • It may be not a bug for someone else, but it is a bug for owners of the mouse of your model. It's something that needs to be dealt with. libinput already has a quirk to disable debounce for VMWare mouse, adding another one for yours should be an easy change. – Hi-Angel Jan 01 '20 at 11:46
  • Btw, I think I can help you with this though. Can you please execute libinput list-devices | grep Device, and tell which one is your mouse name? – Hi-Angel Jan 01 '20 at 11:51
  • SINOWEALTH Wired Gaming Mouse – Custard Jan 01 '20 at 12:54
  • Okay, can you please make sure your /etc/libinput/local-overrides.quirks file has the following content. (if /etc/libinput directory doesn't exist, create it). Then you need to restart XServer (for example, just reboot). After that, check whether double click started working. If it didn't, try it again with this content (it's same as previous, but with 2 asterisks added). – Hi-Angel Jan 01 '20 at 13:12
  • 1
    Neither seemed to work. Just to make sure I'm referring to double clicking as a method by which you click the mouse once but it sends two clicks signals as seen here – Custard Jan 01 '20 at 14:09
  • Oh, okay, so it's not a physical double-click button. Either way, this quirk should've disabled debounce for your mouse, so I'm not sure what else could be the problem. Can you please make an evemu-record of the problem (for example, run evemu-record > log.txt), and share it somehow, through pastebin or whatever. – Hi-Angel Jan 01 '20 at 16:25
  • Did 10 clicks most of which were double clicks. pastebin – Custard Jan 01 '20 at 18:44
  • Thanks, indeed this looks as if debounce is still turned on. Odd. Can you please share a libinput record of a non-working double-click – Hi-Angel Jan 01 '20 at 19:22
  • using libinput debug-events I recorded 5 double clicks although it looks like there's only 5 regular clicks. pastebin – Custard Jan 02 '20 at 15:00
  • Okay, but I need libinput record because it says what quirks are currently applied among other stuff. – Hi-Angel Jan 02 '20 at 16:01
  • I updated to libinput 1.11 (libinput record doesn't exist it 1.10) should be working now. 5 double clicks here – Custard Jan 02 '20 at 20:57
  • Ok, so, this is odd, I see no quirks: field, which I have on my system just above events: one (it is empty, but it's there). Maybe it's because you have very old libinput, 1.11.1 was released 1.5 years ago, latest stable is 1.14.3. Anyway, a few questions: 1) Did you name the file exactly as /etc/libinput/local-overrides.quirks? 2) Did you not add any additional content, such as comments, indentation, spaces around = symbol? 3) If you run libinput debug-events --verbose and make a click with mouse, does it say about debounce a DEBOUNCE_STATE_IS_UP or DEBOUNCE_STATE_DISABLED? – Hi-Angel Jan 03 '20 at 00:24
  • You know what, I figured out why it wasn't working for you! I just thought "could that be that because you're using very old libinput, it haven't got the option to disable debouncing?". So, quirk grep over sources + git blame, and I found that the option to disable it was only introduced a year ago. Besides, it seems back then quirks were using another format. Indeed per this blog post by maintainer, the format was changed in 1.12. – Hi-Angel Jan 03 '20 at 00:58
  • 1
    Updated libinput using the answer to this thread and it's working now! I didn't read all the comments so libinput --version displays it as 1.15.0 whilst synaptic package manager still displays the version as 1.11.1-1 however I don't think this will be an issue and if so I can always refer back to the thread I just mentioned. Thanks for the help. – Custard Jan 03 '20 at 20:24
  • Yeah, as of today latest release is 1.15.0. About package manager: this is odd. I hope you didn't just copy libraries to your system (e.g. by executing ninja install), thus bypassing the package manager, did you? Because if you did, those files gonna get overwritten on the next minor update of libinput package. – Hi-Angel Jan 03 '20 at 21:49
  • 1
    I did do that however I will use the method I saw in the comments if I ever notice it stops working:sudo checkinstall ninja -C builddir/ install. – Custard Jan 03 '20 at 22:29
  • Fun fact: apparently this is your mouse mentioned in commit for Linux kernel 5.7. – Hi-Angel Mar 19 '20 at 21:53

2 Answers2

7

Just reposting the discussion in comments as an answer.

First of, to avoid confusion: OP does not have a hardware button for double-clicks. Rather, the double-click they were referring to is when you tap left mouse button in such a special way so it bounces and causes 2 clicks. I could reproduce it with my mouse too.

This is almost never a wanted behavior, so libinput has a debounce algorithm in place, which detects and discards such bounces. (and just for the record: it works fine with hardware double-click buttons). So OP asked if they can disable it locally.

It is indeed possible via quirk subsystem. Before I go on, I need to quote documentation:

For temporary local workarounds, libinput reads the /etc/libinput/local-overrides.quirks file. Users may add a sections to this file to add a device quirk for a local device but beware that any modification must be upstreamed or it may cease to work at any time.

Warning: Model quirks are internal API and may change at any time. No backwards-compatibility is guaranteed. Local overrides should only be used until the distribution updates the libinput packages.

So quirks subsystem is not a configuration API. If you have a problem which can be solved with a quirk, the quirk most likely needs to be upstreamed.

With that said, the following code placed at /etc/libinput/local-overrides.quirks file helped the OP to get the bouncing-behavior:

[SINOWEALTH Wired Gaming Mouse]
MatchName=SINOWEALTH Wired Gaming Mouse
ModelBouncingKeys=1

The mouse model name is one from libinput list-devices | grep Device output. For this to work libinput needs to be at least of 1.12.0 version (for OP it worked on libinput 1.15.0).

Hi-Angel
  • 3,702
  • 1
  • 29
  • 36
  • Upvoted. I also think that your comment about what would happen after an update would be beneficial to be included in your answer. A suggested solution (if possible) for this case would be even better! – BeastOfCaerbannog Jan 06 '20 at 14:29
  • 2
    @user3140225 well, I specifically didn't mention how to update libinput, because there's another question/answer on that matter, which OP has used to do the update. And that post has similar comments too. I'm hoping one day there either would appear a PPA for latest libinput or somebody will write an answer on how to do installation via checkinstall. But I unforunately can do neither because I don't have Ubuntu (I'm an Archlinux user, and my gf is using Fedora). – Hi-Angel Jan 06 '20 at 14:34
1

Another way to do this is to execute the following command in terminal

#!/bin/sh

sudo mkdir -p /etc/libinput sudo tee /etc/libinput/local-overrides.quirks >/dev/null <<ENDHERE [Never Debounce] MatchUdevType=mouse ModelBouncingKeys=1 ENDHERE

Then Reboot your computer

I found this solution on Reddit: Disable double click prevention