Add File -> Minimize to tray toggle (default on)
Adds a checkable MenuItem so the user can opt out of the hide-to-tray behavior. Persisted per-user to %APPDATA%\WebhookServer\gui.json so the choice survives restarts. When ticked (default): X / Alt+F4 / minimize hide to tray, GUI process keeps running, tray icon persists. When unticked: X actually closes the app, minimize is a regular Windows minimize. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -38,7 +38,7 @@ public partial class MainWindow : Window
|
||||
|
||||
private void OnClosing(object? sender, CancelEventArgs e)
|
||||
{
|
||||
if (ExitForReal)
|
||||
if (ExitForReal || !_vm.MinimizeToTrayEnabled)
|
||||
{
|
||||
_tray.Dispose();
|
||||
return;
|
||||
@@ -58,9 +58,10 @@ public partial class MainWindow : Window
|
||||
|
||||
private void OnStateChanged(object? sender, EventArgs e)
|
||||
{
|
||||
// Minimize-to-tray: hide the window when the user minimizes; restoring is
|
||||
// via the tray icon's double-click or context menu.
|
||||
if (WindowState == WindowState.Minimized)
|
||||
// Minimize-to-tray: hide the window when the user minimizes IF they've
|
||||
// opted in via File -> Minimize to tray. Otherwise behave like a normal
|
||||
// Windows minimize.
|
||||
if (WindowState == WindowState.Minimized && _vm.MinimizeToTrayEnabled)
|
||||
{
|
||||
Hide();
|
||||
ShowInTaskbar = false;
|
||||
|
||||
Reference in New Issue
Block a user