-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwnl.ahk
More file actions
71 lines (63 loc) · 1.81 KB
/
wnl.ahk
File metadata and controls
71 lines (63 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
;@Ahk2Exe-SetName WindowsNightLightCLI
;@Ahk2Exe-SetDescription Changes monitor brightness and Windows Night Light settings.
;@Ahk2Exe-SetVersion 1.0.0
;@Ahk2Exe-SetCopyright 2025 elModo7 - VictorDevLog
;@Ahk2Exe-SetOrigFilename wnl.exe
;@Ahk2Exe-ConsoleApp
#NoEnv
#SingleInstance Force
#NoTrayIcon
global version := "1.0.0"
global appName := "WindowsNightLightCLI"
; Libs
#Include <Screen>
#Include <Chalk>
#Include <ConsoleMessages>
#Include <WindowsNightLight>
; Globals
global nightLight := 0, nightLightStrength := 0, brightness := 0
; Init
initCLIMessages()
Loop, %0%
{
param := %A_Index%
switch
{
case param == "-h" || param == "-help":
showHelp()
case InStr(param, "-nightlight="):
nightLight := StrSplit(param, "=")[2]
case InStr(param, "-nightlight_strength="):
nightLightStrength := StrSplit(param, "=")[2]
case (InStr(param, "-brightness=")):
brightness := StrSplit(param, "=")[2]
default:
cliLoudErrorMessage("`r`nUnknown command: " param)
cliWarningMessage("`r`nType -h for a list of available commands`r`n")
ExitApp
}
}
if (!param)
showHelp()
if (nightLightStrength < 0 || nightLightStrength > 100 || nightLightStrength == "") {
cliLoudWarningMessage("nightlight_strength must be a value between 0 and 100")
ExitApp
}
if (brightness < 0 || brightness > 100 || brightness == "") {
cliLoudWarningMessage("brightness must be a value between 0 and 100")
ExitApp
}
if (nightLight) {
NightLight_SetStrength(nightLightStrength)
NightLight_Enable()
} else {
NightLight_Disable()
}
setMonitorBrightness(brightness)
ExitApp
showHelp() {
global
cliLoudSuccessMessage("`r`nAvailable commands:")
cliInfoMessage("`r`n-nightlight=<0-1> -> Set Night Light mode ON/OFF`r`n-nightlight_strength=<0-100> -> Sets Night Light Intensity`r`n-brightness=<0-100> -> Sets Screen Brigthness`r`n")
ExitApp
}