Skip to content

Add OS-level notifications when a long chat response finishes while app is unfocused #714

Closed

Description

@haiphucnguyen

Summary

Add OS-level notifications so users are alerted when a chat response finishes while Askimo is not the focused/foreground application. This should be an opt-in, user-configurable feature (default off), consistent with how other optional features (e.g. voice) are handled in AppConfig.

Motivation

Users often switch away from Askimo while waiting on a long-running chat/agent response (e.g. multi-step agent runs, slow models, RAG queries). Today there's no way to know a response finished without switching back to check - an OS notification would close that gap, similar to Slack/Discord/ChatGPT desktop behavior.

Current behavior

  • desktop-shared/src/main/kotlin/io/askimo/ui/shell/NotificationComponents.kt only implements an in-app notification bell/popup — nothing surfaces at the OS level.
  • desktop/src/main/kotlin/io/askimo/desktop/Main.kt owns the WindowState (rememberPersistedWindowState()) but there's no tracking of whether the window currently has OS focus.
  • ChatViewModel drives isLoading/isThinking but there's no EventBus event fired specifically on "response completed" that other parts of the app can react to.
  • There is no existing expect/actual abstraction in the codebase (checked — none found), so this would be the first cross-platform (desktop/Android) native integration point.

Proposed solution

  1. Cross-platform notifier abstraction

    • Add expect object AppNotifier { fun notify(title: String, message: String) } in a shared module.
    • actual implementation for desktop: Compose Desktop Tray/Notification API (or java.awt.SystemTray/TrayIcon as fallback).
    • actual implementation for android (askimo-app/android): NotificationManagerCompat with a dedicated NotificationChannel.
  2. Window focus tracking (desktop)

    • Track whether the app window currently has OS focus (e.g. via WindowFocusListener on the underlying AWT window, or Compose Desktop's focus APIs) and expose it as state (e.g. isWindowFocused: Boolean) from app() in Main.kt.
  3. "Response completed" event

    • Emit a new EventBus event (e.g. ChatResponseCompletedEvent(sessionId, preview)) from ChatViewModel when a chat/agent run finishes, following the existing pattern used for InvalidateCacheEvent, RunCodeEvent, etc.
  4. Wiring

    • Add a LaunchedEffect in app() that collects ChatResponseCompletedEvent and calls AppNotifier.notify(...) only when the window is unfocused and the feature is enabled in settings.
  5. User-configurable setting

    • Add a notifications config section to AppConfig (shared/src/main/kotlin/io/askimo/core/config/AppConfig.kt), mirroring the existing voice config block:
      data class NotificationsConfig(
          val enabled: Boolean = false, // opt-in, default off
          val onlyWhenUnfocused: Boolean = true,
      )
    • Surface a toggle in Settings UI (new or existing SettingsSection), following the same pattern as other feature toggles (e.g. ApplicationPreferences.getShowTokenUsageCard()).
    • Default to enabled

Out of scope (future considerations)

  • Notification click-to-focus / deep-linking back to the specific session.
  • Per-session or per-agent-run granular notification preferences.
  • Notification sound customization.

References

  • desktop-shared/src/main/kotlin/io/askimo/ui/shell/NotificationComponents.kt (existing in-app notification bell)
  • desktop/src/main/kotlin/io/askimo/desktop/Main.kt (WindowState, app() composable, EventBus collectors pattern)
  • shared/src/main/kotlin/io/askimo/core/config/AppConfig.kt (voice config block as a reference pattern for opt-in features)
  • io.askimo.core.event.EventBus

Activity

  1. added
    enhancement
    on Sep 10, 2026
  2. changed the title [-]dd OS-level notifications when a long chat response finishes while app is unfocused[/-] [+]Add OS-level notifications when a long chat response finishes while app is unfocused[/+] on Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions