Last active
November 12, 2024 21:47
-
-
Save krrr/3c3f1747480189dbb71f to your computer and use it in GitHub Desktop.
Windows screen brightness fine tune (autohotkey)
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
#,:: | |
AdjustScreenBrightness(-3) | |
Return | |
#.:: | |
AdjustScreenBrightness(3) | |
Return | |
AdjustScreenBrightness(step) { | |
service := "winmgmts:{impersonationLevel=impersonate}!\\.\root\WMI" | |
monitors := ComObjGet(service).ExecQuery("SELECT * FROM WmiMonitorBrightness WHERE Active=TRUE") | |
monMethods := ComObjGet(service).ExecQuery("SELECT * FROM wmiMonitorBrightNessMethods WHERE Active=TRUE") | |
minBrightness := 5 ; level below this is identical to this | |
for i in monitors { | |
curt := i.CurrentBrightness | |
break | |
} | |
if (curt < minBrightness) ; parenthesis is necessary here | |
curt := minBrightness | |
toSet := curt + step | |
if (toSet > 100) | |
return | |
if (toSet < minBrightness) | |
toSet := minBrightness | |
for i in monMethods { | |
i.WmiSetBrightness(1, toSet) | |
break | |
} | |
} |
If there was a way to adjust the brightness through "hovering the mouse on the top part of screen and then using the mouse wheel", instead of pressing the Shift key on the keyboard while using the mouse wheel would be a great, speedy action and yet more practical to my mind.
Could the current code be written this way? I did not have the knowledge to write it myself :(
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@venturqx, @Rabelaiss
Here is my updated code with windows GUI brightness overlay... working on my Lenovo laptop with Win 10.