User Review 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.
1721750373292.png


2. In profiles, select the Scripting icon.
1721750848361.png


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:
EnablePrimaryMouseButtonEvents(true);
lastInstance = 0;
debounceTime = 5; -- debounce time in ms
buttonID = 1; -- 1 is primary mouse button, 2 is secondary, 3 scroll

function OnEvent(event, arg)

if event == "MOUSE_BUTTON_PRESSED" and arg == buttonID then
if(GetRunningTime() - lastInstance) >= debounceTime then
PressMouseButton(buttonID);
OutputLogMessage(" - Pressing button\n");
else
OutputLogMessage(" ! Too fast!\n");
end

elseif event == "MOUSE_BUTTON_RELEASED" and arg == buttonID then
ReleaseMouseButton(buttonID);
OutputLogMessage(" - Releasing button\n");
lastInstance = GetRunningTime();

else
OutputLogMessage("Booooring!\n") -- some button we don't care about
end
end
1721751186822.png


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)

1721751646286.png


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

  • 1721750781150.png
    1721750781150.png
    99.7 KB · Views: 40
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.
 
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.
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 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.
 
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.
 
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:
 
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:
It means the stock logitech switches are of inferior quality or have a very short lifespan.
 
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.
 
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.
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.
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:
    • 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
If the script above doesn't work, use this version instead

Code:
    1. function OnEvent(event, arg)
    2. if IsMouseButtonPressed(3)then
    3. repeat
    4. if IsMouseButtonPressed(1) then
    5. repeat
    6. MoveMouseRelative(0,1)
    7. Sleep(33)
    8. until not IsMouseButtonPressed(1)
    9. end
    10. until not IsMouseButtonPressed(3)
    11. end
    12. end
    [*]
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. EnablePrimaryMouseButtonEvents(true);

    2. function OnEvent(event, arg)
    3. --only supported in v8.94.108+
    4. if IsKeyLockOn("numlock" )then
    5. if IsMouseButtonPressed(3)then
    6. repeat
    7. --norecoil
    8. if IsMouseButtonPressed(1) then
    9. PressKey("Q")
    10. Sleep(20)
    11. ReleaseKey("Q")
    12. repeat
    13. MoveMouseRelative(0,1)
    14. --change this value
    15. Sleep(33)
    16. until not IsMouseButtonPressed(1)
    17. end

    18. --Rapid Fire Script
    19. if IsMouseButtonPressed(4) then
    20. PressKey("Q")
    21. Sleep(20)
    22. ReleaseKey("Q")
    23. repeat
    24. PressMouseButton(1)
    25. Sleep(30)
    26. ReleaseMouseButton(1)
    27. MoveMouseRelative(0,3)
    28. Sleep(30)
    29. until not IsMouseButtonPressed(4)
    30. end
    31. --perfect burst
    32. if IsMouseButtonPressed(5) then
    33. repeat
    34. PressMouseButton(1)
    35. Sleep(150)
    36. ReleaseMouseButton(1)
    37. Sleep(170)
    38. until not IsMouseButtonPressed(5)
    39. end
    40. until not IsMouseButtonPressed(3)
    41. end
    42. --quickscope
    43. if IsMouseButtonPressed(5) then
    44. repeat
    45. PressMouseButton(3)
    46. Sleep(30)

    47. PressKey("lshift")
    48. --how long the scoping in takes
    49. Sleep(380)
    50. PressMouseButton(1)
    51. Sleep(50)
    52. ReleaseMouseButton(1)

    53. ReleaseKey("lshift")

    54. ReleaseMouseButton(3)
    55. --how long it takes after shooting to repeat
    56. Sleep(500)
    57. until not IsMouseButtonPressed(5)
    58. end
    59. if IsMouseButtonPressed(4) then
    60. --zoom in + rapid fire
    61. if IsKeyLockOn("capslock") then
    62. PressMouseButton(3)
    63. PressKey("Q")
    64. Sleep(20)
    65. ReleaseKey("Q")
    66. repeat
    67. PressMouseButton(1)
    68. Sleep(30)
    69. ReleaseMouseButton(1)
    70. --change this value
    71. MoveMouseRelative(0,3)
    72. Sleep(30)
    73. until not IsMouseButtonPressed(4)
    74. ReleaseMouseButton(3)
    75. else
    76. --zoom in and normal recoil control
    77. PressMouseButton(3)
    78. PressMouseButton(1)
    79. PressKey("Q")
    80. Sleep(20)
    81. ReleaseKey("Q")
    82. repeat
    83. MoveMouseRelative(0,1)
    84. --change this value
    85. Sleep(33)
    86. until not IsMouseButtonPressed(4)
    87. ReleaseMouseButton(3)
    88. ReleaseMouseButton(1)
    89. end
    90. end
    91. --quick revive
    92. if IsMouseButtonPressed(2) then
    93. PressKey("4")
    94. Sleep(30)
    95. ReleaseKey("4")
    96. Sleep(700)
    97. PressMouseButton(1)
    98. Sleep(30)
    99. ReleaseMouseButton(1)
    100. PressKey("1")
    101. end
    102. end
    103. end
    [*]
Used while playing BF.
Also, brace yourselves for a ban if using scripts!

 
Last edited:
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.
@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.
 
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.
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.



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.
 
Last edited:
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.



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.
Some games (like minecraft) have advantage for faster debounce time. But yeah what you said is right.
 
Back
Top