This commit is contained in:
jahruz67
2026-05-08 19:09:02 -07:00
parent cb48a97365
commit 32008149d6
6 changed files with 81 additions and 12 deletions
+13
View File
@@ -37,6 +37,8 @@ var trayLabel = "wis-free-v3"
// Menu item references for dynamic updates
var statusMenuItem *systray.MenuItem
var triggerCountItem *systray.MenuItem
var triggerCount int
// Start initializes and runs the system tray.
// This function blocks until the tray is terminated.
@@ -74,6 +76,9 @@ func onReady(app App) {
statusMenuItem = systray.AddMenuItem("Status: Ready", "Current application status")
statusMenuItem.Disable()
triggerCountItem = systray.AddMenuItem("Shortcut detected: 0 times", "Troubleshooting counter")
triggerCountItem.Disable()
systray.AddSeparator()
menuSettings := systray.AddMenuItem("Settings", "Open settings window")
@@ -159,6 +164,14 @@ func UpdateStatus(status string) {
}
}
// IncrementTriggerCount increments the troubleshooting counter in the tray.
func IncrementTriggerCount() {
triggerCount++
if triggerCountItem != nil {
triggerCountItem.SetTitle(fmt.Sprintf("Shortcut detected: %d times", triggerCount))
}
}
// onExit is called when the system tray is shutting down.
func onExit() {
logger.Info("System tray terminated")