Skip to content

Commit 1a35f41

Browse files
Roveyclaude
andcommitted
fix(gui): closing the window always hides to the tray
It quit when there was no tune to keep applied, which looked like the tray app stopping (always the case for a read-only window). Exit in the tray menu quits; a balloon says so the first time the window closes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 18f7148 commit 1a35f41

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ That builds two programs in `.\build\Release\`: `GpuAutoOptimizer.exe`, the wind
4444

4545
Start `GpuAutoOptimizer.exe`. The **Dashboard** shows the GPU with live telemetry, what is applied right now next to the saved tune (with **Apply saved tune**, the **Apply at logon** switch and **Revert to stock**), the four profiles and a log of what happened. On the **Optimize** page, pick a profile and press **Optimize GPU** (it offers to restart as administrator first, because tuning writes clocks and power limits). The run shows temperature, power and every probe as it happens; **Abort** restores stock. The results compare before and after and can turn on apply at every logon.
4646

47-
With apply-at-logon on, Windows starts the app in the tray at every logon. It applies the saved tune and then keeps it applied: every 30 seconds it reads back what the driver reports. If the tune was reset (a driver reset or TDR), it applies it again; if that happens four times within an hour it stops and tells you the tune is probably not stable; if another program such as MSI Afterburner changed the settings, it leaves them alone and tells you; after a driver update it does not apply the old tune and tells you to optimize again. While it keeps a tune applied (or a run is in progress), closing the window keeps it in the tray and **Exit** in the tray menu quits; otherwise closing the window quits. **Revert to stock** in the tray menu, or `gao --reset` from a shell, puts the card at stock and the watchdog leaves it there until you apply the tune again (window, tray menu or `gao --apply`). Only one optimize runs at a time, from the window or the command line.
47+
With apply-at-logon on, Windows starts the app in the tray at every logon. It applies the saved tune and then keeps it applied: every 30 seconds it reads back what the driver reports. If the tune was reset (a driver reset or TDR), it applies it again; if that happens four times within an hour it stops and tells you the tune is probably not stable; if another program such as MSI Afterburner changed the settings, it leaves them alone and tells you; after a driver update it does not apply the old tune and tells you to optimize again. Closing the window keeps the app in the tray; **Exit** in the tray menu quits. **Revert to stock** in the tray menu, or `gao --reset` from a shell, puts the card at stock and the watchdog leaves it there until you apply the tune again (window, tray menu or `gao --apply`). Only one optimize runs at a time, from the window or the command line.
4848

4949
### The command line
5050

‎docs/hardware-checks.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ root; adjust the path for a Debug build.
6060
| 34 | Watchdog backs off from another tool | tray running, set an offset in MSI Afterburner and Apply | no | a balloon says another program changed the settings; the watchdog does not fight it | |
6161
| 35 | One instance | start the app twice | no | the second start brings the first window forward and exits | Pass (2026-09-27, after the P5 fix pass): the second start exits with code 0, the first keeps running. |
6262
| 36 | CLI and tray side by side | tray running with the tune kept applied; `gao --reset`, wait 45 s, `gao --status`; then `gao --optimize` from a shell while the window runs an optimize | yes | after `--reset` the card stays at stock (the tray notes it and does not re-apply); after `gao --apply` the tray keeps the tune applied again; the second optimize refuses with `another optimize is already running` | Pass for reset and apply (2026-09-27): after `gao --reset` the card stayed at stock for 45 s with the tray running (no watchdog line); `gao --apply` applied the tune again. Two optimizes at once not yet tried. |
63-
| 37 | Closing the window | close the window with no tune applied, then again with a tune kept applied | no / yes | without a tune the app exits; with one it hides to the tray | Pass without a tune (2026-09-27): the app exits on close. |
63+
| 37 | Closing the window | close the window, then choose Exit in the tray menu | no | closing hides the window to the tray (a balloon says so the first time); Exit quits | |
6464

6565
## Notes
6666

‎src/app/gui/main_gui.cpp‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ struct App {
8080
bool watch = false; // keep the saved tune applied (off after a revert or a reset by choice)
8181
bool worker_was_running = false;
8282
bool strike_pending = false; // a logon apply whose 2-minute grace has not passed yet
83+
bool told_about_tray = false; // the "still running in the tray" balloon, once per session
8384

8485
// Crash dumps are written by a thread created up front (a crashing thread
8586
// may have no stack or heap left to do it itself).
@@ -539,13 +540,13 @@ LRESULT CALLBACK wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) {
539540
return 0;
540541
}
541542
case WM_CLOSE:
542-
// With a tune to keep applied, or a run in progress, the window
543-
// hides and the tray stays. Otherwise there is nothing to stay for.
544-
if (g.watch || g.worker->running()) {
545-
ShowWindow(hwnd, SW_HIDE);
546-
g.visible = false;
547-
} else {
548-
g.exit_requested = true;
543+
// Closing hides to the tray, like other tray apps; Exit in the tray
544+
// menu quits. Say so the first time, or it looks like a quit.
545+
ShowWindow(hwnd, SW_HIDE);
546+
g.visible = false;
547+
if (!g.told_about_tray) {
548+
g.told_about_tray = true;
549+
tray_icon(NIM_MODIFY, nullptr, L"Still running in the tray. Right-click the icon and choose Exit to quit.");
549550
}
550551
return 0;
551552
case WM_TIMER:

0 commit comments

Comments
 (0)