Skip to content

feat: Minimized mode with popup window on session completion#415

Open
PureWeen wants to merge 3 commits intomainfrom
feature/minimized-popup-mode
Open

feat: Minimized mode with popup window on session completion#415
PureWeen wants to merge 3 commits intomainfrom
feature/minimized-popup-mode

Conversation

@PureWeen
Copy link
Owner

Summary

When PolyPilot is not focused and a session completes, a compact popup window appears with the last response and a text input for quick follow-up. After sending, the popup auto-closes.

Enable via Settings → UI → Notifications → Minimized Mode Popup (desktop only, disabled by default).

How it works

  1. App.xaml.cs subscribes to window.Activated/window.Deactivated to track focus
  2. When a session completes (SessionIdleEvent), if the main window is unfocused and the setting is on, MinimizedModeService.OnSessionCompleted() is called instead of a system notification
  3. A new MAUI Window is opened with a PopupChatPage hosting a PopupChatView Blazor component
  4. The popup shows: session name header, last assistant response, text input (Enter to send), Open / Dismiss buttons
  5. On send: SendPromptAsync fires, popup closes, main window switches to the session
  6. Multiple completions are queued — each popup opens after the previous is dismissed

New files

  • Services/IMinimizedModeService.cs — interface (test-safe, no MAUI types)
  • Services/MinimizedModeService.cs — concrete with MAUI window management + queue
  • Components/PopupChat/PopupChatHost.razor — Blazor root for the popup BlazorWebView
  • Components/PopupChat/PopupChatView.razor — compact chat UI
  • Components/PopupChat/PopupChatView.razor.css — dark theme, uses var(--type-*) and var(--font-base)
  • PopupChatPage.xaml/.cs — MAUI ContentPage hosting the BlazorWebView

Modified files

  • App.xaml.cs — focus tracking via window events
  • CopilotService.Events.cs — hooks session completion to show popup (falls back to system notification if popup not applicable)
  • ConnectionSettings.csEnableMinimizedMode (default: false)
  • SettingsRegistry.cs — UI setting (desktop only)
  • MauiProgram.cs — DI registration
  • PolyPilot.Tests/TestStubs.csStubMinimizedModeService for tests

Tests

All 2897 tests pass.

PureWeen and others added 3 commits March 21, 2026 16:05
When PolyPilot is not focused and a session completes, a compact
popup window appears showing the last response with a text input
for quick follow-up. After sending, the popup auto-closes.

New files:
- Services/IMinimizedModeService.cs — interface (test-safe)
- Services/MinimizedModeService.cs — concrete with MAUI window management
- Components/PopupChat/PopupChatHost.razor — Blazor root for popup window
- Components/PopupChat/PopupChatView.razor — compact chat UI (header, response, input)
- Components/PopupChat/PopupChatView.razor.css — dark theme styling
- PopupChatPage.xaml/.cs — MAUI ContentPage hosting the BlazorWebView

Modified:
- App.xaml.cs — tracks window.Activated/Deactivated for focus state
- CopilotService.Events.cs — hooks session completion to show popup
- ConnectionSettings.cs — adds EnableMinimizedMode (default: false)
- SettingsRegistry.cs — exposes setting in UI (desktop only)
- MauiProgram.cs — registers MinimizedModeService singleton

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add 📌 pin button to dashboard toolbar (desktop only) that enables
  always-on-top window mode, keeping PolyPilot above all other windows
- In always-on-top mode, show only the top Focus session in a compact
  single-session view with queue badge for waiting sessions
- Persist IsAlwaysOnTop in UiState, restore window level on startup
- Add MacSleepWakeMonitor: subscribes to NSWorkspace sleep/wake
  notifications so connection health is checked immediately on wake
  (fixes PolyPilot stopping work after Mac sleep)
- Add WindowLevelHelper: sets UIWindow.WindowLevel to 1001f (above
  normal app windows, below system UI) on Mac Catalyst

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…etting

- WindowLevelHelper: change from broken level 1001 (screensaver level,
  blocked by macOS sandboxing) to level 3 (NSFloatingWindowLevel) which
  correctly floats above all normal app windows
- WindowLevelHelper: also set NSWindow via P/Invoke on libobjc for
  reliable behavior; set collectionBehavior=canJoinAllSpaces|managed
  so window stays visible on all Spaces
- Remove 'Minimized Mode Popup' checkbox from Settings UI (the popup
  window approach was abandoned in favor of Always On Top mode)
- Keep EnableMinimizedMode in ConnectionSettings.cs for JSON compat

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant