Created
December 22, 2019 06:45
-
-
Save AeliusSaionji/8b31bd4d32acf6a091df3f24b93aba3a to your computer and use it in GitHub Desktop.
Some desktop usability functions for logitech mice in LogitechGamingSoftware
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Tap G8 to quick alt+tab | |
--Hold G8 to navigate alt+tab interface with mouseover | |
--RAlt + RClick = move window | |
function OnEvent(event, arg) | |
OutputLogMessage("event = %s, arg = %s\n", event, arg) | |
if (event == "MOUSE_BUTTON_PRESSED" and arg == 8) then | |
timeStart = GetRunningTime() | |
PressKey("lalt") | |
PressAndReleaseKey("tab") | |
elseif (event == "MOUSE_BUTTON_RELEASED" and arg == 8) then | |
--Measure time elapsed since button_pressed event. | |
elapsed = GetRunningTime() - timeStart | |
OutputLogMessage("held for %dms\n",elapsed) | |
if (elapsed >= 200) then | |
OutputLogMessage("long press: sending lclick\n") | |
--Click on the alt+tab entry under the cursor. | |
--Alt+tab merely loses focus if anywhere else is clicked. | |
PressAndReleaseMouseButton(1) | |
--Slight delay ensures lclick happens before releasing lalt | |
Sleep(20) | |
end | |
--Always release lalt in any condition. | |
ReleaseKey("lalt") | |
end | |
if (event == "MOUSE_BUTTON_PRESSED" and arg == 2 and IsModifierPressed("ralt")) then | |
ReleaseKey("ralt") | |
Sleep(200) | |
PressKey("ralt") | |
Sleep(200) | |
PressAndReleaseKey("spacebar") | |
Sleep(20) | |
ReleaseKey("ralt") | |
Sleep(20) | |
PressAndReleaseKey("m") | |
Sleep(20) | |
PressAndReleaseKey("up") | |
Sleep(20) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment