Skip to content

Instantly share code, notes, and snippets.

@krrr
Last active May 19, 2025 13:38
Show Gist options
  • Save krrr/3c3f1747480189dbb71f to your computer and use it in GitHub Desktop.
Save krrr/3c3f1747480189dbb71f to your computer and use it in GitHub Desktop.
Windows screen brightness fine tune (autohotkey)
#,::
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
}
}
@TheBestPessimist
Copy link

@noticz are you still using the code for the overlay? I tried using it and it shows me the volume OSD instead. For reference, my windows version is 24H2.

Also, i'd like to ask how did you come to find those UUIDs? I found they come from Immersive Shell, but i have no idea how that works. This is what i found in oleView
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment