Skip to content

fix(notify): start the Windows tray at logon without a console - #349

Merged
T-Crypt merged 2 commits into
mainfrom
T-Crypt/notify-hidden-at-logon
Nov 16, 2026
Merged

T-Crypt merged 2 commits into
mainfrom
T-Crypt/notify-hidden-at-logon

Conversation

@T-Crypt

@T-Crypt T-Crypt commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Closes #344.

What changes

berth service install --notify wrote the bare berth.exe notify to HKCU\...\Run\BerthNotify. berth.exe is a console program, so a console opened at every logon. Closing that window sent CTRL_CLOSE_EVENT and ended the tray.

The Run value is now wscript.exe //B //Nologo "<state>\units\berth-notify.vbs". This is the hidden launcher the daemon, gateway and harbor tasks already use. No console opens, and the tray's output goes to logs\berth-notify.log. service uninstall deletes the stub along with the Run value. You need to run the install again to replace an older Run value.

This keeps one binary. A separate -H windowsgui build for the tray would need a second exe, because the CLI needs console stdio.

Proof

  • TestNotifyAtLogonStartsTheTrayHidden (Windows only) checks that the Run value is wscript on the stub, not the exe, and that the stub runs berth.exe notify hidden with its output going to the log. It does not build without the change. I ran it under wine together with the existing TestServiceInstallWindows* and TestServiceUninstallWindows* tests, and all of them passed. The windows CI job runs it on Windows.
  • Full proof is green: build, gofmt, vet, go test ./..., the Windows build and vet, golangci-lint 2.14.0.
  • I have not tested it on a real Windows logon yet. The reporter's workaround is the same stub pattern.

service install --notify wrote the bare berth.exe to the user's Run key.
berth.exe is a console program, so a console opened at every logon, and
closing it sent CTRL_CLOSE_EVENT and ended the tray. The Run value is now
wscript on a berth-notify.vbs stub, the launcher the other units use:
no console, berth notify runs hidden, and its output goes to
logs\berth-notify.log. Uninstall removes the stub with the Run value.

Closes #344
@T-Crypt
T-Crypt merged commit 365f02c into main Nov 16, 2026
4 checks passed
@T-Crypt
T-Crypt deleted the T-Crypt/notify-hidden-at-logon branch November 16, 2026 14:49
T-Crypt added a commit that referenced this pull request Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: berth notify opens a visible console window at logon; closing it kills the tray

1 participant