Skip to content

Commit 6d8541e

Browse files
ranjeshjCopilot
andauthored
Fix tray disconnected behavior (#451)
## Summary - Hide usage from the tray menu while disconnected. - Route tray icon left-click to the Connection page unless the operator is connected. ## Validation - GitHub checks passed before merge. Co-authored-by: Copilot <[email protected]>
1 parent 679f21c commit 6d8541e

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎src/OpenClaw.Tray.WinUI/App.xaml.cs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,13 @@ private void InitializeTrayMenuWindow()
841841

842842
private void OnTrayIconSelected(TrayIcon sender, TrayIconEventArgs e)
843843
{
844-
ShowChatWindow();
844+
if (_connectionManager?.CurrentSnapshot.OperatorState == RoleConnectionState.Connected)
845+
{
846+
ShowChatWindow();
847+
return;
848+
}
849+
850+
ShowHub("connection");
845851
}
846852

847853
internal void ShowChatWindow()

‎src/OpenClaw.Tray.WinUI/Services/TrayMenuStateBuilder.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ internal void Build(TrayMenuWindow menu)
288288
menu.AddFlyoutCustomItem(sessionsRow, sessionsFlyout, action: "sessions");
289289
}
290290

291-
// ── Usage (no divider — flows directly under Sessions) ──
291+
// ── Usage (connected only; stale disconnected usage is misleading) ──
292+
if (isConnected)
292293
{
293294
var usageRow = BuildUsageRow(secondaryText);
294295
var usageFlyout = BuildUsageFlyoutItems(secondaryText);

0 commit comments

Comments
 (0)