Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
daviduuang committed Sep 8, 2018
0 parents commit a927a2d
Show file tree
Hide file tree
Showing 16 changed files with 772 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
Binary file added ImageResource/toggle-on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ImageResource/touchpad-disable-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions ImageResource/touchpad-disable-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ImageResource/touchpad-enable-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions ImageResource/touchpad-enable-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ImageResource/touchpad-toogle-icon.ico
Binary file not shown.
Binary file added ImageResource/touchpad.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TouchpadToggle
Binary file not shown.
Binary file added ScreenCapture/F12Setting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ScreenCapture/FnKeySetting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions Src/TouchpadToogle.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#NoTrayIcon
#NoEnv
#SingleInstance off

SAPI := ComObjCreate("SynCtrl.SynAPICtrl.1")
SDev := ComObjCreate("SynCtrl.SynDeviceCtrl.3")

SAPI.Initialize()
SAPI.Activate()

/*
first parameter is ConnectionType, 0 = Any Connection
second parameter is DeviceType, 2 = TouchPad Device
third parameter is QueryHandle, - 1 = automatically select the first device that meet criteria
*/
DeviceHandle := SAPI.FindDevice(0,2,-1)

SDev.Select(DeviceHandle)
SDev.Activate()

; 268435825 stands for "enable/disable" option
; 1: disable;0: enable
DisableFlag := SDev.GetLongProperty(268435825)

if(DisableFlag = 1)
{
;enable it
SDev.SetLongProperty(268435825, 0)
OnScreenDisplay(0, 1500)
}
else
{
;disable it
SDev.SetLongProperty(268435825, 1)
OnScreenDisplay(1, 1500)
}

ObjRelease(SAPI)
ObjRelease(SDev)

ExitApp


; Display Image Which Stands for Touchpad Disabled Status on screen.
OnScreenDisplay(DisableStatus, time=1500)
{
image_name := ""
if (DisableStatus = 1)
{
image_name = %A_ScriptDir%\touchpad-disable.png
}
else
{
image_name = %A_ScriptDir%\touchpad-enable.png
}

ypos := A_ScreenHeight * 0.8
; Create a borderless SplashImage window
SplashImage, %image_name%, b y%ypos%,,,WinTitle_touchpad_toggle
; Make the window a little bit transparent.
;Winset, TransColor, White 250, WinTitle_touchpad_toggle
Sleep, %time%
SplashImage, Off
return
}
Binary file added Src/touchpad-disable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Src/touchpad-enable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a927a2d

Please sign in to comment.