Skip to content

Add active and active-plus-critical floatbar modes - #296

Merged
tsouth89 merged 3 commits into
mainfrom
tsouth2/sbs-176-add-active-provider-and-active-plus-critical-floatbar-modes
Aug 15, 2026
Merged

Add active and active-plus-critical floatbar modes#296
tsouth89 merged 3 commits into
mainfrom
tsouth2/sbs-176-add-active-provider-and-active-plus-critical-floatbar-modes

Conversation

@tsouth89

@tsouth89 tsouth89 commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds Pinned (default), Active, and Active + critical modes for which providers the floating bar shows.
  • Active follows the focused supported desktop app or a terminal whose title names a known agent.
  • Active + critical also keeps pinned providers at or above the warning threshold.
  • An unrelated foreground app keeps the last active provider. Watching is local, cached, and does not call provider APIs. Users can turn it off.

SBS-176.

Test plan

  • cargo test --manifest-path rust/Cargo.toml settings::tests
  • cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml foreground
  • pnpm --dir apps/desktop-tauri exec vitest run src/floatbar/selection.test.ts src/floatbar/SettingsSection.test.tsx src/floatbar/FloatBar.test.tsx
  • pnpm --dir apps/desktop-tauri run check-locale
  • On Windows: enable the floating bar, set Active, focus Cursor / Claude / a claude terminal, then Chrome, and confirm the last provider stays.

Note

Medium Risk
Changes float bar visibility logic and adds periodic foreground process inspection on Windows; non-Windows builds cannot detect focus, so active modes may not behave as users expect outside Windows.

Overview
Adds Pinned, Active, and Active + critical modes for which providers the floating bar shows. Pinned stays the default and unchanged behavior.

Active shows only the last matched provider for the focused supported desktop app or a terminal whose title hints at an agent. Active + critical keeps that provider and also any pinned providers at or above the high-usage warning threshold. If focus is unrelated or unknown, the bar keeps the last active provider instead of clearing.

On Windows, the Tauri backend polls the foreground window (~750ms), maps process path and title to a provider id (Ceiling itself and VS Code are not auto-mapped to Copilot), caches last active, and emits foreground-provider-changed. The float bar listens and calls get_foreground_provider on mount. Detection is local only—no provider API calls—and can be turned off while staying in an active mode.

New persisted settings floatBarSelectionMode and floatBarForegroundDetection flow through the bridge, float bar settings UI (with locale strings), and selectVisibleFloatBarProviders in the React float bar. Foreground watching is not implemented off Windows (read_foreground is a stub), so active modes there rely on cached last-active state until/unless detection is added.

Reviewed by Cursor Bugbot for commit 4cd18ff. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add active and active-plus-critical selection modes to the FloatBar

  • Adds two new FloatBar provider selection modes (active, activePlusCritical) alongside the existing pinned default, controlled by a new floatBarSelectionMode setting.
  • In active modes, a Rust background poller runs every 750ms on Windows to detect the foreground app, maps it to a provider ID via executable name and terminal window title heuristics, and emits foreground-provider-changed events to the frontend.
  • The FloatBar React component subscribes to these events and uses selectVisibleFloatBarProviders to show only the active provider (active) or the active provider plus any pinned providers above the high-usage threshold (activePlusCritical).
  • A new floatBarForegroundDetection boolean setting (default true) lets users disable OS-level foreground detection; when disabled or in pinned mode, the bar falls back to the pinned list.
  • Settings UI in SettingsSection.tsx exposes a mode selector and a WatchFocusedApp toggle (disabled in pinned mode).
  • Risk: Foreground detection is Windows-only and always returns null on other platforms; the 750ms polling task is cancelled via a generation counter when settings change.

Macroscope summarized 4cd18ff.

Summary by CodeRabbit

  • New Features

    • Added Floating Bar provider selection modes: pinned providers, the active provider, or the active provider plus critical providers.
    • Added optional focused-app detection to automatically follow the provider used in the foreground.
    • Added a setting to disable focused-app monitoring.
    • Added local-only detection behavior, with fallback to pinned providers when the active app is unavailable or unrelated.
    • Added English and Chinese localization for the new settings.
  • Documentation

    • Added unreleased changelog details covering the new Floating Bar behavior.

Pinned providers stay the default. Active shows the provider
for the focused supported app or terminal agent. Active plus
critical also keeps providers at the warning threshold. An
unrelated window keeps the last active provider. Detection is
local and can be turned off.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ceiling 4cd18ff Commit Preview URL

Branch Preview URL
Aug 15 2026, 06:12 AM

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 98e1be1b-4fa7-4faa-a93a-7cea4b8ec00b

📥 Commits

Reviewing files that changed from the base of the PR and between e15cb19 and 4cd18ff.

📒 Files selected for processing (30)
  • CHANGELOG.md
  • apps/desktop-tauri/src-tauri/Cargo.toml
  • apps/desktop-tauri/src-tauri/permissions/commands.toml
  • apps/desktop-tauri/src-tauri/src/commands/bridge.rs
  • apps/desktop-tauri/src-tauri/src/commands/settings.rs
  • apps/desktop-tauri/src-tauri/src/floatbar/mod.rs
  • apps/desktop-tauri/src-tauri/src/foreground.rs
  • apps/desktop-tauri/src-tauri/src/foreground/matching.rs
  • apps/desktop-tauri/src-tauri/src/main.rs
  • apps/desktop-tauri/src/App.test.tsx
  • apps/desktop-tauri/src/floatbar/FloatBar.test.tsx
  • apps/desktop-tauri/src/floatbar/FloatBar.tsx
  • apps/desktop-tauri/src/floatbar/SettingsSection.test.tsx
  • apps/desktop-tauri/src/floatbar/SettingsSection.tsx
  • apps/desktop-tauri/src/floatbar/selection.test.ts
  • apps/desktop-tauri/src/floatbar/selection.ts
  • apps/desktop-tauri/src/i18n/keys.ts
  • apps/desktop-tauri/src/lib/tauri.ts
  • apps/desktop-tauri/src/surfaces/PopOutPanel.test.tsx
  • apps/desktop-tauri/src/surfaces/TrayPanel.test.tsx
  • apps/desktop-tauri/src/surfaces/settings/tabs/AboutTab.test.tsx
  • apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.test.tsx
  • apps/desktop-tauri/src/types/bridge.test.ts
  • apps/desktop-tauri/src/types/bridge.ts
  • rust/src/locale.rs
  • rust/src/locale/en-US.ftl
  • rust/src/locale/zh-CN.ftl
  • rust/src/settings.rs
  • rust/src/settings/raw.rs
  • rust/src/settings/tests.rs

📝 Walkthrough

Walkthrough

The floating bar now supports pinned, active, and active-plus-critical provider modes. Local foreground detection matches supported applications and terminals, tracks the last active provider, and updates visible providers through persisted settings.

Changes

Floating-bar foreground selection

Layer / File(s) Summary
Settings and bridge contracts
rust/src/settings.*, apps/desktop-tauri/src-tauri/src/commands/*, apps/desktop-tauri/src/types/bridge.ts
Persisted settings support selection modes and foreground detection, with normalization, defaults, snapshots, updates, and patch application.
Foreground detection and matching
apps/desktop-tauri/src-tauri/src/foreground/*, apps/desktop-tauri/src-tauri/src/main.rs, apps/desktop-tauri/src-tauri/Cargo.toml, apps/desktop-tauri/src-tauri/permissions/commands.toml
Windows foreground inspection, provider matching, polling, Tauri commands, change events, and watch eligibility were added.
Provider visibility and settings UI
apps/desktop-tauri/src/floatbar/*, apps/desktop-tauri/src/lib/tauri.ts, apps/desktop-tauri/src/i18n/keys.ts, rust/src/locale/*, apps/desktop-tauri/src/**/*test*, CHANGELOG.md
The float bar filters providers by mode and usage, and the settings UI exposes mode and focused-app monitoring controls with localization and test coverage.

Estimated code review effort: 4 (Complex) | ~60 minutes

Merge Risk: ⚪ Minimal · up to 4cd18

This change is merge-ready after normal checks and review; no actionable merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant FloatBar
  participant TauriBridge
  participant ForegroundWatcher
  participant WindowsAPI
  FloatBar->>TauriBridge: getForegroundProvider()
  TauriBridge->>ForegroundWatcher: get_foreground_provider
  ForegroundWatcher->>WindowsAPI: read foreground window
  WindowsAPI-->>ForegroundWatcher: executable and title
  ForegroundWatcher-->>TauriBridge: provider snapshot
  TauriBridge-->>FloatBar: current and last-active provider
  ForegroundWatcher-->>FloatBar: foreground-provider-changed
  FloatBar->>FloatBar: select visible providers
Loading

Possibly related PRs

Suggested reviewers: finesssee, 0reki, darknight105

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 74.55% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: adding active and active-plus-critical floatbar selection modes.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tsouth2/sbs-176-add-active-provider-and-active-plus-critical-floatbar-modes

Comment @coderabbitai help to get the list of available commands.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8f7f214. Configure here.

Comment thread apps/desktop-tauri/src-tauri/src/foreground/matching.rs
A cwd named cursor or codex was treated as the focused agent.
Only the title prefix before a path separator is used, and the
leftmost agent name wins.
@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown

Automated review

New in this pass: 2 issues.

  1. exe_stem only strips .exe/.EXE, misses mixed-case extensions

    apps/desktop-tauri/src-tauri/src/foreground/matching.rs:77 · disposition: fix-if-quick · confidence: high · severity: medium · quick win

    exe_stem does file.strip_suffix(".exe").or_else(|| file.strip_suffix(".EXE")) before lowercasing. Input "C:\Tools\Claude.Exe" or "codex.EXe" leaves the extension intact, lowercases to "claude.exe"/"codex.exe", which never matches DESKTOP_APPS ("claude","codex") or TERMINAL_EXES. Result: foreground detection returns None and active mode falls back to pinned, so the bar never follows that app.

    Prompt for AI agents

    In apps/desktop-tauri/src-tauri/src/foreground/matching.rs around line 77: Make the strip case-insensitive (e.g., lower-case first or strip_suffix case-insensitively) and test with "Claude.Exe" and "Codex.EXE". Verify against the current code first; if no longer valid, skip with a brief reason. Keep the change minimal.

  2. Terminal title hints miss several desktop providers

    apps/desktop-tauri/src-tauri/src/foreground/matching.rs:44 · disposition: fix-if-quick · confidence: high · severity: medium · quick win

    TITLE_HINTS only contains cursor/claude/codex/grok/gemini/copilot/windsurf/opencode. DESKTOP_APPS also maps warp, zed, factory/droid, kiro, augment, antigravity, opencode-go. Sequence: user runs warp/zed/factory agent in WindowsTerminal with title "warp — ~/proj" or "factory — ~/proj". match_title_hint tokenizes prefix "warp"/"factory" but provider_for_title_token finds no hint, returns None, so active/activePlusCritical never shows that provider and stays on pinned.

    Prompt for AI agents

    In apps/desktop-tauri/src-tauri/src/foreground/matching.rs around line 44: Add the missing provider hints to TITLE_HINTS (warp, zed, factory, kiro, augment, antigravity, opencode-go) or document why they are intentionally excluded; add a test for "warp — ~/src" in a terminal exe. Verify against the current code first; if no longer valid, skip with a brief reason. Keep the change minimal.

Resolved since the previous pass: 10.

For coding agents: fix BLOCK and FIX IF QUICK findings now; everything else is tracked or informational; never exceed one CodeRev fix round per PR.

Advisory. Findings generated by grok-subscription and muse-spark-1.2-contributor, each filtered through a 3-vote refutation panel with the changed code in evidence.

Comment thread apps/desktop-tauri/src-tauri/src/foreground/matching.rs
Comment thread apps/desktop-tauri/src/floatbar/selection.ts
Comment thread apps/desktop-tauri/src-tauri/src/foreground/matching.rs Outdated
Comment thread apps/desktop-tauri/src-tauri/src/foreground/matching.rs
Comment thread apps/desktop-tauri/src-tauri/src/foreground/matching.rs Outdated
Comment thread apps/desktop-tauri/src-tauri/src/foreground.rs Outdated
Comment thread apps/desktop-tauri/src-tauri/src/foreground/matching.rs

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Comment thread apps/desktop-tauri/src-tauri/src/foreground.rs Outdated
Comment thread apps/desktop-tauri/src-tauri/src/foreground/matching.rs
Comment thread apps/desktop-tauri/src-tauri/src/foreground/matching.rs Outdated
Keep the pinned list until a match exists. Prefer an agent title
inside Warp. Recognize Windows Terminal Preview. Use the catalog
id for OpenCode Go. Strip mixed-case .exe names. Do not put
window titles on the event, and read the focused window off the
async runtime.
@tsouth89
tsouth89 merged commit 09523ce into main Aug 15, 2026
14 of 15 checks passed
@tsouth89
tsouth89 deleted the tsouth2/sbs-176-add-active-provider-and-active-plus-critical-floatbar-modes branch August 15, 2026 06:17
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