-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFireFlyFy.ahk
More file actions
94 lines (84 loc) · 2.17 KB
/
Copy pathFireFlyFy.ahk
File metadata and controls
94 lines (84 loc) · 2.17 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
;@Ahk2Exe-SetName FireFlyFy
;@Ahk2Exe-SetDescription Changes monitor brightness based on active window.
;@Ahk2Exe-SetVersion 1.0.0
;@Ahk2Exe-SetCopyright 2025 elModo7 - VictorDevLog
;@Ahk2Exe-SetOrigFilename FireFlyFy.exe
;~ ;@Ahk2Exe-ConsoleApp ; Only for CLI Mode (maybe for a future revision as I will already be releasing a standalone CLI binary)
#NoEnv
#SingleInstance Force
#Persistent
SetTitleMatchMode, 3
DetectHiddenWindows, On
SetBatchLines -1
CoordMode, Mouse, Screen
FileEncoding, UTF-8
global version := "1.0.0"
global appName := "FireFlyFy"
; Libs
#Include <Screen>
#Include <cJSON>
#Include <i18n>
#Include <Utils>
#Include <AboutScreen>
#Include <WindowsNightLight>
; Globals
global initialBrightness, appPrev, processPrev, globalConfig, appsConfig, isVisible := 1, fireFlyFyEnabled := 1
global curLang := {}, langC, languages
; Languages
getLanguages()
i18n := new i18n("", "en_US", ["en_US"])
loadTranslations()
; Init
initCLIMessages()
createOrReadConfig()
installResources()
setInitialBrigthness()
configureTray()
createNightFilter()
Gui +LastFound
hWnd := WinExist()
DllCall("RegisterShellHookWindow", UInt, hWnd)
registerWindowMessageId := DllCall("RegisterWindowMessage", Str, "SHELLHOOK")
OnMessage(0x404, "trayEventsCapture")
enableFireFlyFy()
gosub, initMouseFollower
OnExit, ExitSub
globalConfig.lookForUpdates ? lookForUpdates(1) : ""
return
detectWindowChanged(wParam, lParam)
{
; https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms644991(v=vs.85)
if ((wParam > 0 && wParam < 5) || wParam == 6 || wParam == 32772) {
Settimer, checkCurrentApp, 100
}
}
checkCurrentApp:
Settimer, checkCurrentApp, Off
WinGetActiveTitle, appCur
WinGet, processCur, ProcessName, A
if (appCur != appPrev || processCur != processPrev) {
appPrev := appCur
processPrev := processCur
for appK, appV in appsConfig.apps
{
if (appV.activeBy == "title") {
if (appCur == appV.title) {
applyFireFlyFy(appV)
return
}
} else {
if (processCur == appV.process) {
applyFireFlyFy(appV)
return
}
}
}
removeFireFlyFy()
}
return
#Include <LabelUtils>
/* TODO:
Scheduler (default no)
Update, autoreplace running executable
Add CLI
*/