Skip to content

Commit aec6d7c

Browse files
author
vmartinez
committed
Add translations.
Complete functionality. This is a pre release, preparing updater.
1 parent 8809cce commit aec6d7c

34 files changed

Lines changed: 1666 additions & 177 deletions

FireFlyFy.ahk

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,40 @@
11
;@Ahk2Exe-SetName FireFlyFy
22
;@Ahk2Exe-SetDescription Changes monitor brightness based on active window.
33
;@Ahk2Exe-SetVersion 1.0.0
4-
;@Ahk2Exe-SetCopyright Copyright (c) 2025`, elModo7 - VictorDevLog
4+
;@Ahk2Exe-SetCopyright 2025 elModo7 - VictorDevLog
55
;@Ahk2Exe-SetOrigFilename FireFlyFy.exe
6+
;~ ;@Ahk2Exe-ConsoleApp ; Only for CLI Mode (maybe for a future revision as I will already be releasing a standalone CLI binary)
67
#NoEnv
78
#SingleInstance Force
89
#Persistent
910
SetTitleMatchMode, 3
1011
DetectHiddenWindows, On
1112
SetBatchLines -1
1213
CoordMode, Mouse, Screen
13-
global version := "0.1.3"
14+
FileEncoding, UTF-8
15+
global version := "0.1.9"
1416
global appName := "FireFlyFy"
1517

1618
; Libs
1719
#Include <Screen>
1820
#Include <cJSON>
21+
#Include <i18n>
1922
#Include <Utils>
2023
#Include <AboutScreen>
2124
#Include <WindowsNightLight>
2225

2326
; Globals
2427
global initialBrightness, appPrev, processPrev, globalConfig, appsConfig, isVisible := 1, fireFlyFyEnabled := 1
28+
global curLang := {}, langC, languages
29+
30+
; Languages
31+
getLanguages()
32+
i18n := new i18n("", "en_US", ["en_US"])
33+
loadTranslations()
2534

2635
; Init
36+
initCLIMessages()
2737
createOrReadConfig()
28-
loadTranslations(globalConfig.language)
2938
installResources()
3039
setInitialBrigthness()
3140
configureTray()
@@ -39,6 +48,8 @@ OnMessage(0x404, "trayEventsCapture")
3948

4049
enableFireFlyFy()
4150
gosub, initMouseFollower
51+
OnExit, ExitSub
52+
globalConfig.lookForUpdates ? lookForUpdates(1) : ""
4253
return
4354

4455
detectWindowChanged(wParam, lParam)
@@ -58,13 +69,13 @@ checkCurrentApp:
5869
processPrev := processCur
5970
for appK, appV in appsConfig.apps
6071
{
61-
if (appV.activeBy == "process") {
62-
if (processCur == appV.process) {
72+
if (appV.activeBy == "title") {
73+
if (appCur == appV.title) {
6374
applyFireFlyFy(appV)
6475
return
6576
}
6677
} else {
67-
if (appCur == appV.title) {
78+
if (processCur == appV.process) {
6879
applyFireFlyFy(appV)
6980
return
7081
}
@@ -79,21 +90,8 @@ return
7990
^Esc::Reload
8091

8192
/* TODO:
82-
Add window / process -> FireFly follows mouse when choosing, enter chooses, escape cancels
83-
title or processName (default by process)
84-
brightnessValue 0-100 (default 50)
85-
nightLightStrength 0-100 (default 50)
86-
Block that if you have by title of the same process, you can not add a rule by process unless you remove the ones by title before, maybe prompt of those that match and offer removing?
87-
88-
8993
application list
90-
91-
Start with windows (default no)
9294
Scheduler (default no)
93-
progressive change yes/no (default yes)
94-
multilingual
95-
Clear config
96-
9795
Update, autoreplace running executable
9896
Add CLI
9997
*/

config/apps.json

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,5 @@
1-
{
2-
"apps": [
3-
{
4-
"activeBy": "process",
5-
"brightness": 30,
6-
"changeBrightness": 1,
7-
"name": "Notepad",
8-
"process": "Notepad.exe",
9-
"readMode": 0,
10-
"nightLightStrength": 0,
11-
"title": "New text document"
12-
},
13-
{
14-
"activeBy": "process",
15-
"brightness": 50,
16-
"changeBrightness": 0,
17-
"name": "IntelliJ",
18-
"process": "idea64.exe",
19-
"readMode": 1,
20-
"nightLightStrength": 50,
21-
"title": "Whatever"
22-
},
23-
{
24-
"activeBy": "title",
25-
"brightness": 50,
26-
"changeBrightness": 1,
27-
"name": "Google Chrome",
28-
"process": "Chrome.exe",
29-
"readMode": 1,
30-
"nightLightStrength": 50,
31-
"title": "Wikipedia, la enciclopedia libre - Google Chrome"
32-
}
33-
]
1+
{
2+
"apps": {
3+
4+
}
345
}

config/apps_win10.json

Lines changed: 0 additions & 34 deletions
This file was deleted.

config/global.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
{
2-
"experimentalReadFilter": 0,
3-
"language": "en-US",
4-
"lookForUpdates": 1,
5-
"progressive": 1,
6-
"startWithWindows": 0
1+
{
2+
"experimentalReadFilter": "0",
3+
"language": "en_US",
4+
"lookForUpdates": "1",
5+
"progressive": "1",
6+
"scheduler": "0",
7+
"schedulerEndHours": 0,
8+
"schedulerEndMinutes": 0,
9+
"schedulerFrom": "20251120175457",
10+
"schedulerStartHours": 0,
11+
"schedulerStartMinutes": 0,
12+
"schedulerUntil": "20251120175457",
13+
"startWithWindows": "0"
714
}

lib/Chalk.ahk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,6 @@ class Chalker {
9696
; Return the final string
9797
return prefix str Chalker._reset
9898
}
99-
}
99+
}
100+
101+
global chalk := new Chalker()

lib/ConsoleMessages.ahk

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
initCLIMessages() {
2+
global
3+
cliLoudWarningMessage(appName " v" version " - elModo7 / VictorDevLog - " A_YYYY)
4+
cliInfoMessage(i18n.t("cli_version_in_beta", {app: appName}))
5+
}
6+
7+
cliInfoMessage(msgTxt) {
8+
global
9+
msg := chalk.cyan(msgTxt "`r`n")
10+
FileAppend, %msg%, *
11+
}
12+
13+
cliSuccessMessage(msgTxt) {
14+
global
15+
msg := chalk.green(msgTxt "`r`n")
16+
FileAppend, %msg%, *
17+
}
18+
19+
cliLoudSuccessMessage(msgTxt) {
20+
global
21+
msg := chalk.bold.green.underline(msgTxt "`r`n")
22+
FileAppend, %msg%, *
23+
}
24+
25+
cliWarningMessage(msgTxt) {
26+
global
27+
msg := chalk.yellow(msgTxt "`r`n")
28+
FileAppend, %msg%, *
29+
}
30+
31+
cliLoudWarningMessage(msgTxt) {
32+
global
33+
msg := chalk.bold.yellow.underline(msgTxt "`r`n")
34+
FileAppend, %msg%, *
35+
}
36+
37+
cliErrorMessage(msgTxt) {
38+
global
39+
msg := chalk.red(msgTxt "`r`n")
40+
FileAppend, %msg%, *
41+
}
42+
43+
cliLoudErrorMessage(msgTxt) {
44+
global
45+
msg := chalk.bold.red.underline(msgTxt "`r`n")
46+
FileAppend, %msg%, *
47+
}

lib/FireFlyFy.ahk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ setInitialBrigthness() {
8080
enableFireFlyFy() {
8181
global
8282
if (!fireFlyFyEnabled) {
83-
Menu, Tray, Rename, % "Enable " appName, % "Disable " appName
84-
Menu tray, Icon, % "Disable " appName, % A_Temp "\" appName "\disabled.ico"
83+
Menu, Tray, Rename, % i18n.t("tray_enable_app", {app: appName}), % i18n.t("tray_disable_app", {app: appName})
84+
Menu tray, Icon, % i18n.t("tray_disable_app", {app: appName}), % A_Temp "\" appName "\disabled.ico"
8585
}
8686
fireFlyFyEnabled := 1
8787
OnMessage(registerWindowMessageId, "detectWindowChanged")
@@ -90,8 +90,8 @@ enableFireFlyFy() {
9090
disableFireFlyFy() {
9191
global
9292
if (fireFlyFyEnabled) {
93-
Menu, Tray, Rename, % "Disable " appName, % "Enable " appName
94-
Menu tray, Icon, % "Enable " appName, % A_Temp "\" appName "\enabled.ico"
93+
Menu, Tray, Rename, % i18n.t("tray_disable_app", {app: appName}), % i18n.t("tray_enable_app", {app: appName})
94+
Menu tray, Icon, % i18n.t("tray_enable_app", {app: appName}), % A_Temp "\" appName "\enabled.ico"
9595
}
9696
fireFlyFyEnabled := 0
9797
OnMessage(registerWindowMessageId, "")

0 commit comments

Comments
 (0)