Prevent accidental clicks of thinkpad x230 touchpad

Post your working scripts, libraries and tools for AHK v1.1 and older
TOTAL
Posts: 52
Joined: 11 Nov 2016, 13:47

Prevent accidental clicks of thinkpad x230 touchpad

28 Mar 2024, 13:09

Touchpad has never worked 100% reliably on thinkpads, but the greatest nuisance has always been the proneness to accidental touching while typing. There were some driver versions which tried to address that but never reliably.

So I have some up with an idea - and gemini put it to action: the touchpad and its left click should only work when fn button is pressed. Makes you use the mouse as a minigun, so no drinking coffee while navigating the screen but it has become completely immune to accidental touches.

Still not perfect, but does the trick.

Code: Select all


#NoEnv
SendMode Input

; State variable to keep track of whether Fn key is pressed
FnKeyPressed := 0

; Check if the Fn key (SC163) is being pressed
SC163::
    FnKeyPressed := 1
    BlockInput, MouseMoveOff ; Enable mouse input
    SetTimer, DisableMouseInput, -1 ; Set a timer to disable mouse input after 1 ms
return

; Check if the Fn key (SC163) is being released
SC163 Up::
    FnKeyPressed := 0
    BlockInput, MouseMove ; Disable mouse input immediately
return

; Check if the left mouse button is pressed down
LButton::
    if FnKeyPressed = 1
        Send, {LButton Down}
return

; Check if the left mouse button is released
LButton Up::
    Send, {LButton Up}
return

DisableMouseInput:
    If !FnKeyPressed
        BlockInput, MouseMove ; Disable mouse input
return
gregster
Posts: 9035
Joined: 30 Sep 2013, 06:48

Re: Prevent accidental clicks of thinkpad x230 touchpad

28 Mar 2024, 13:18

Hi @TOTAL, I moved your topic from Scripts and Functions (v2) to the corresponding AHK v1 subforum. Perhaps you have missed that AHK v2 is the new main release, and that we have now separate forums for AHK v1 and AHK v2 topics.
(I also fixed a broken code tag - a ] was missing.)
TOTAL
Posts: 52
Joined: 11 Nov 2016, 13:47

Re: Prevent accidental clicks of thinkpad x230 touchpad

28 Mar 2024, 14:05

OK, thanks. Looks like I must have a dated version installed.
gregster
Posts: 9035
Joined: 30 Sep 2013, 06:48

Re: Prevent accidental clicks of thinkpad x230 touchpad

28 Mar 2024, 14:27

Yes, in a sense - AHK v1 has reached its (official) end of life a few days ago, lexikos won't develop it any further (anyone is free to fork it though, and we continue to provide subforums for it). But please note that v2 has many syntax changes and is not very compatible to most v1 code. But you can have both versions installed at the same time - but this a bit offtopic here.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: fiendhunter and 185 guests