Mouse Double click issue solution by coding

Since the last couple of days, I was quite troubled by the double-clicking issue of my mouse (Logitech G502 Hero)
Today, I came across a solution for this through a simple code which is posted on Reddit. I simply copy pasted it into my Logitech G Hub app and like magic, the issue is gone.
So, I wanted to share the procedure here for anyone who is facing the issue. This might even work for other branded mouse in through their respective apps (I don’t know :))

Procedure:

1. Open Logitech G Hub app. Goto Manage profile in the dropdown as in the image.

2. In profiles, select the Scripting icon.

3. Rename the script to anything as required (I named it left click). Paste the code as in the image. Save and Run under Script dropdown. 90% job done.
Script:

After all this is done, disable your left click like mine was disabled in the first image.
(IF THIS IS NOT DONE THEN EVERY LEFT CLICK WILL REGISTER AS TWO CLICKS. ONE FROM CODE AND ONE DEFAULT)

Note:
Never change the active LUA script (image 3). Since the left click is disabled, once the active script is changed, your left click stops working.
Either the script is to be made active again (image 3) or Default is to be selected for the left click to work again.
But how to do all this if the left click is not working?
Press windows Key. search for ‘Mouse settings’. Change the primary mouse button to Right by using down arrow.
Now either select the script back or enable the left key. Reselect the primary mouse button to Left from mouse settings.

ENJOY.
Let me know if this is working. (Its working for me :))


Attachments:

11 Likes

Well this is certainly new although I’m not sure of the resource usage and latency impact since you’re intercepting every mouse event.
Other cheaper way is to just clean the mouse button switch using IPA or replace it.

1 Like

Not facing any issue. Even the drag and drop works. The debounceTime was 50 in the initial code. I changed it to 5 ms. since I felt 50 ms is too much time.

Also [this site](’

https://codepen.io/blink172/pen/vERyxK

) helps by checking if any double clicks are being registered or not.

I have used such script codes couple of years ago on one of my logitechs. I wanted to make some re-mappings etc. cant recall exactly but there are few such scripts on the net to try.

1 Like

Interesting solution, but sadly only applicable to mouses used on a single computer. When my M235 started double-clicking I opened up it’s switches and cleaned it with WD40. Problem solved. Hope it lasts a few more years.

Seems every Logitech mouses develops this fault within 2-3 years.

The above solution is an instant one. It only requires few clicks and its done. I agree that it is a temporary solution. Everything is fine but left clicks are not getting registered on Minecraft launcher. Except that remaining games are fine. Cleaning the switches is the ultimate solution.

Wow didnt know about this. When my Logitech G304 developed double clicking, I ordered 2 TTC Gold switches for Rs 200, disassembled the mouse to get the daughter board with the original omron switches and went to a mobile shop that soldered the switches for Rs 100. New switches so much better - its been three years and no trace of double clicking. This is great for those who may not want to tinker with the mouse. Cheers mate :headphone:

1 Like

It means the stock logitech switches are of inferior quality or have a very short lifespan.

1 Like

To be honest, this defeats the purpose of a gaming mouse. This script sounds like it waits a little longer before telling the computer that a click has been detected. This adds latency to the response. Not noticeable for regular usage, but for competitive gaming, you’re giving away a bit of advantage the mouse should give you.

@@CrimeMouse don’t use wd40. It leaves residue and will attract dust in Indian conditions and make things worse. Get a contact cleaner spray with minimal residue or change the switches.

Oh yeah, atleast the G304 is plagued with double clicking issues. It has omron low quality switches.

Some mouse (and keyboards) have custom debounce function integrated into their software which you can set according to how you like. I don’t understand why this isn’t the industry standard. Surely it will reduce number of RMA’s for them to process thus being beneficial for them to add.
I used to use a logitech g402 mouse and itworked great until it didn’t and started having the same double clicking issue like others. It would fix by itself for some days then revert back to the problem. Now I use a razer basilisk v3 and its while it doesn’t have double click issue its quality is inferior and scroll wheel started to stop working from time to time. So it seems like we can’t a good mid-budget mouse without sacrificing on something.

I used WD40 for the scroll wheel since I had nothing else and it did make things worse but somehow fixed the problem after a few hours? I don’t know what happened there and for how long it will stay fixed because I have used WD40 for squeaky door hinges etc and saw it does attract dust like you said. Guess that is one downside of it being a general purpose all rounder spray.
Is this the contact cleaner you are talking about? Also is it non-conductive?

https://www.amazon.in/WD-40-Specialist®-Contact-Cleaner-400ml/dp/B0B9SZBLL8

Sorry if this derails the thread, thought I would talk about it for those looking for a more permanent solution than limiting click rate through a software.

I haven’t tried the product in the link yet. It claims to be both non residue and non conductive.
The stuff I’ve tried all leaves residue. The best is deoxit which i got in the US but couldn’t carry home because it was inflammable.

What i do these days is clean up the area around the switch with lots of spirit and leave it to dry for a while before using

Logitech Mouse Simple Anti Recoil Scripts for Battlefield

Battlefield:

Script that pulls down the mouse while shooting.

Code:

  1. [SPOILER=“Code”]
  • EnablePrimaryMouseButtonEvents(true);

  • function OnEvent(event, arg)

  • if IsKeyLockOn(“numlock” )then

  • if IsMouseButtonPressed(3)then

  • repeat

  • if IsMouseButtonPressed(1) then

  • repeat

  • MoveMouseRelative(0,1)

  • Sleep(33)

  • until not IsMouseButtonPressed(1)

  • end

  • until not IsMouseButtonPressed(3)

  • end

  • end

  • end

[/SPOILER]

If the script above doesn’t work, use this version instead

Code:

  1. [SPOILER=“code”]

  2. function OnEvent(event, arg)

  3. if IsMouseButtonPressed(3)then

  4. repeat

  5. if IsMouseButtonPressed(1) then

  6. repeat

  7. MoveMouseRelative(0,1)

  8. Sleep(33)

  9. until not IsMouseButtonPressed(1)

  10. end

  11. until not IsMouseButtonPressed(3)

  12. end

  13. end

[*][/SPOILER]

You have to open your Logitech Gaming Series Software and select a Profile,
To **activate **the script you first have to activate Numlock on your keyboard, then you have to **press mouse 2 **and when you shoot with mouse 1 the script will pull down the mouse
You can activate and deactivate the sript on the fly, for instance if you use a sniper rifle or a shotgun etc

Works **with 8.94 ** Logitech Gaming Software and later.

  1. [SPOILER=“BF1-4”]

  2. EnablePrimaryMouseButtonEvents(true);

  3. function OnEvent(event, arg)

  4. –only supported in v8.94.108+

  5. if IsKeyLockOn(“numlock” )then

  6. if IsMouseButtonPressed(3)then

  7. repeat

  8. –norecoil

  9. if IsMouseButtonPressed(1) then

  10. PressKey(“Q”)

  11. Sleep(20)

  12. ReleaseKey(“Q”)

  13. repeat

  14. MoveMouseRelative(0,1)

  15. –change this value

  16. Sleep(33)

  17. until not IsMouseButtonPressed(1)

  18. end

  19. –Rapid Fire Script

  20. if IsMouseButtonPressed(4) then

  21. PressKey(“Q”)

  22. Sleep(20)

  23. ReleaseKey(“Q”)

  24. repeat

  25. PressMouseButton(1)

  26. Sleep(30)

  27. ReleaseMouseButton(1)

  28. MoveMouseRelative(0,3)

  29. Sleep(30)

  30. until not IsMouseButtonPressed(4)

  31. end

  32. –perfect burst

  33. if IsMouseButtonPressed(5) then

  34. repeat

  35. PressMouseButton(1)

  36. Sleep(150)

  37. ReleaseMouseButton(1)

  38. Sleep(170)

  39. until not IsMouseButtonPressed(5)

  40. end

  41. until not IsMouseButtonPressed(3)

  42. end

  43. –quickscope

  44. if IsMouseButtonPressed(5) then

  45. repeat

  46. PressMouseButton(3)

  47. Sleep(30)

  48. PressKey(“lshift”)

  49. –how long the scoping in takes

  50. Sleep(380)

  51. PressMouseButton(1)

  52. Sleep(50)

  53. ReleaseMouseButton(1)

  54. ReleaseKey(“lshift”)

  55. ReleaseMouseButton(3)

  56. –how long it takes after shooting to repeat

  57. Sleep(500)

  58. until not IsMouseButtonPressed(5)

  59. end

  60. if IsMouseButtonPressed(4) then

  61. –zoom in + rapid fire

  62. if IsKeyLockOn(“capslock”) then

  63. PressMouseButton(3)

  64. PressKey(“Q”)

  65. Sleep(20)

  66. ReleaseKey(“Q”)

  67. repeat

  68. PressMouseButton(1)

  69. Sleep(30)

  70. ReleaseMouseButton(1)

  71. –change this value

  72. MoveMouseRelative(0,3)

  73. Sleep(30)

  74. until not IsMouseButtonPressed(4)

  75. ReleaseMouseButton(3)

  76. else

  77. –zoom in and normal recoil control

  78. PressMouseButton(3)

  79. PressMouseButton(1)

  80. PressKey(“Q”)

  81. Sleep(20)

  82. ReleaseKey(“Q”)

  83. repeat

  84. MoveMouseRelative(0,1)

  85. –change this value

  86. Sleep(33)

  87. until not IsMouseButtonPressed(4)

  88. ReleaseMouseButton(3)

  89. ReleaseMouseButton(1)

  90. end

  91. end

  92. –quick revive

  93. if IsMouseButtonPressed(2) then

  94. PressKey(“4”)

  95. Sleep(30)

  96. ReleaseKey(“4”)

  97. Sleep(700)

  98. PressMouseButton(1)

  99. Sleep(30)

  100. ReleaseMouseButton(1)

  101. PressKey(“1”)

  102. end

  103. end

  104. end

[*][/SPOILER]

Used while playing BF.

Also, brace yourselves for a ban if using scripts!

VALORANT/comments/11xwds2

https://forums.bladeandsoul.com/topic/160156-i-got-banned-for-binding-my-skills-on-my-logitech-g602-mouse/page/4/

https://forums.gamersfirst.com/topic/21701-easyanticheat-allegedly-bans-people-who-use-msi-afterburner-and-logitech-g-hub/

@@greenhorn That’s a very good point that did not occur to me, will use contact cleaner spray next time. Thanks for pointing it out.

Because it requires a software to work, meaning imagine your mouse developed the double click issue, now you have to install the mouse software to increase the mouse button debounce timing.

What will company advertise this as? Oh, if the mouse develops a double click issue you can fix it in our software. This will give the customer a bad vibe towards the company, “so this brand can’t make their mouse perfect in the first place.

Zowie is one brand which is offering this debounce setting in the mouse hardware itself, hold one button and plugging the mouse in changes the debounce timing, they advertise it as “response time”, but the thing is by default it ships with high response time of about 5ms, you can make it go low as 1-2ms. I think there are only two fixed settings.

Why would a brand like zowie ship the mouse with high debounce time? Because they know setting it too low might cause the double click issue too early, mouse switches do wear overtime, so they set it to average to give the player a stable experience for longer. Also due to tolerances of the mouse switches they all can’t be exactly the same, setting a higher debounce time at the factory captures all the edge cases.

[HR][/HR]

I myself is looking to get a decent electric de-soldering iron. So that I can remove mouse buttons and through hole capacitors and change them easily without exposing the PCB to higher temperatures for longer time, which the normal soldering iron and manual de-soldering pump does.

Lots of silicone sprays available on amazon. They dont leave any residue

Some games (like minecraft) have advantage for faster debounce time. But yeah what you said is right.