Skip to content

feat(desktop): add a floating Rome icon on macOS - #462

Merged
Jessie-QingYu merged 9 commits into
mainfrom
desktop-floating-pill
Sep 21, 2026
Merged

Jessie-QingYu merged 9 commits into
mainfrom
desktop-floating-pill

Conversation

@Jessie-QingYu

@Jessie-QingYu Jessie-QingYu commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

Once Rome is behind another app or hidden to the tray, the only ways back are the Dock and the menu-bar icon. This adds a small always-on-top icon on macOS: the Rome mark with the agent's name under it, shown whenever Rome is not the frontmost app. Click raises the main window. Right-click opens a menu (Open Rome, Settings…, Hide floating icon, Stop agent and quit). It can be dragged anywhere and stays there across launches. It is opt-in: off until the user ticks the tray's new "Show floating icon" checkbox, and the icon's own menu can hide it again. Not offered on macOS 27 for now (see the test plan).

Two edits outside the feature. createSettingsWindow() in window.ts now restores and shows an existing Settings window before focusing it: asked from the icon's menu, focus() alone left a minimized window in the Dock. And getDialogWindow() in updater.ts no longer picks an always-on-top window. With the main window in the tray the icon is the only visible window, and the automatic "Update Ready" sheet would attach to it.

image image

Design & Invariants

  • The icon never takes focus and never activates Rome. Its window is a non-focusable panel with acceptFirstMouse. Pressing it, dragging it, or opening its menu leaves the user's app frontmost and their keystrokes where they were.
  • Hidden while Rome is frontmost, driven by did-become-active / did-resign-active. Window focus/blur was rejected: those events follow the main window while getFocusedWindow() follows the key window, and the two disagree while a sheet is attached. One exception: ticking the tray checkbox shows the icon at once even with Rome frontmost, so the tick visibly does something; the next activation hides it as usual. Accepted cost: after ⌘W or minimize Rome is still the active app, so the icon appears once the user switches away.
  • The main process owns geometry; the page owns layout. The page reports gestures and its measured size over one-way IPC, and only the icon's own page is listened to. The window follows the real cursor, is clamped to the display's work area — again when a display is removed or changes — and its position lives in the desktop settings table. -webkit-app-region: drag was rejected because it swallows clicks.
  • Click versus drag is decided at release, from the press and release events' own coordinates. The window is never focused, so while another app is busy the press can arrive late with no moves in between; judging by pointermove alone turned such drags into clicks.
  • The name is agentName from GET /api/settings, fetched with the session's cookies when the runtime becomes ready and when Rome stops being frontmost. No polling. Falls back to "Rome".
  • macOS only.

Test plan

  • pnpm --filter rome-desktop typecheck, pnpm --filter rome-desktop-base-web typecheck, pnpm --filter rome-desktop test (103 pass, 14 new), pnpm lint. The opt-in default is covered by a unit test; a first launch with nothing stored was not run on the device.
  • macOS 26.5, pnpm dev:desktop: appearance; hidden while Rome is frontmost, including with a sheet or file picker open and when switching between the main and Settings windows; one click raises the main window from behind another app, from hidden, and from minimized; typing stays in the other app after a drag and after dismissing the menu; drag follows the cursor and clamps to the screen (21 of 21 drags recognised); position survives a relaunch; menu by right-click and Ctrl-click; hide from the menu, enable from the tray (the icon appears at once, also with Rome frontmost); visible on every Space and over full-screen apps; quit from the menu; "Settings…" from the icon's menu brings back a minimized Settings window; the icon returns to the built-in screen when the external display it sits on is unplugged.
  • pnpm --filter rome-desktop run pack: pill.html and every asset it references are in app.asar.
  • macOS 27. Clicking panel windows activates the app on macOS 27 electron/electron#53889 (open) reports that clicking a panel activates the app there. With the hide rule that would hide the icon mid-gesture, so the feature is off on macOS 27 and later (supportsFloatingPill) until it is checked on a machine or fixed upstream.
  • The packaged app was not launched; only its contents were checked.

Not in this PR

  • Quick chat and a global shortcut: next, as its own PR.
  • Windows and Linux: the panel window type is AppKit's.
  • A switch in the Settings page: the tray checkbox covers it for now.
  • Double-click to open: a light trackpad tap on the icon opens Rome, as it would launch a Dock icon. Left as is.

@zoolsher zoolsher left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔁 This review has been superseded. See the latest review.

@Jessie-QingYu Jessie-QingYu left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🔁 This review has been superseded. See the latest review.

@yunfanye yunfanye left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔁 This review has been superseded. See the latest review.

@zoolsher zoolsher left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔁 This review has been superseded. See the latest review.

@yunfanye yunfanye left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔁 This review has been superseded. See the latest review.

@Jessie-QingYu Jessie-QingYu left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🔁 This review has been superseded. See the latest review.

@yunfanye yunfanye left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔁 This review has been superseded. See the latest review.

@zoolsher zoolsher left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔁 This review has been superseded. See the latest review.

@Jessie-QingYu Jessie-QingYu left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🔁 This review has been superseded. See the latest review.

@zoolsher zoolsher left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔁 This review has been superseded. See the latest review.

@yunfanye yunfanye left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔁 This review has been superseded. See the latest review.

@Jessie-QingYu Jessie-QingYu left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🔁 This review has been superseded. See the latest review.

@zoolsher zoolsher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review: 💬 COMMENT

Adds an opt-in always-on-top "floating pill" icon on macOS (≤ macOS 26) that returns the user to Rome. The design keeps a clean boundary: a non-focusable NSPanel owned by the main process, one-way IPC from the pill page reporting gestures/size, cursor-driven dragging, work-area clamping, and persisted position/enabled state in the desktop settings table. Pure logic is extracted into floating-pill-state.ts with good unit coverage (name parsing, enabled default, position parsing with non-finite guards, platform gating, clamping). Security is careful — IPC is guarded by a fromPill sender check so other-origin pages loaded in the main window can't drive the pill, the settings fetch stays on loopback with the session cookie and its secret-bearing body is never logged, and the renderer runs sandboxed with context isolation. The two edits outside the feature (createSettingsWindow now restores/shows before focus; getDialogWindow skips always-on-top slivers) are justified and I verified they don't regress the non-tray path.\n\nOverall a high-quality change. My only notes are minor: the refreshName path fires an uncoalesced fetch on every deactivation with no in-flight guard (possible stale-name races / overlapping requests), and a couple of fire-and-forget promises could log on rejection. Nothing here rises to a merge blocker.

Verdict: COMMENT — No blocking defects; the feature is well-isolated and tested, with only minor robustness suggestions around the name-refresh path.

2 finding(s) posted as inline comments below.

Severity Category File Title
P2 code-quality packages/desktop/src/main/floating-pill.ts refreshName fires on every deactivation with no coalescing or in-flight guard
P3 error-handling packages/desktop/src/main/floating-pill.ts Fire-and-forget showMainWindow can produce an unhandled rejection

Automated review by RomeOS Code Review · commit 23c782b

try {
// The body is the guardian's whole settings map, connector secrets
// included, and only agentName is read from it. It must never be logged.
const response = await session.defaultSession.fetch(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] code-quality — refreshName fires on every deactivation with no coalescing or in-flight guard

refreshName() runs on every did-resign-active (plus each ready status and enable), and each call starts a fresh session.defaultSession.fetch with a 5s timeout. There is no in-flight guard, so rapid app-switching (a common cmd-tab back-and-forth) can leave several overlapping requests outstanding, and because responses can resolve out of order the last writer wins — an older response can clobber a newer name. In practice agentName rarely changes so this is mostly harmless, but a small guard makes it deterministic and avoids piling up requests:

let refreshing = false;
const refreshName = async (): Promise<void> => {
  if (refreshing) return;
  if (!win || win.isDestroyed() || !runtimeManager.isReady()) return;
  refreshing = true;
  try { /* fetch … */ } finally { refreshing = false; }
};

Dropping overlapping calls (or tracking a request id and ignoring stale responses) removes the race and the redundant load.

ipcMain.on("pill:click", (event) => {
if (!fromPill(event)) return;
dragOffset = null;
void showMainWindow();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P3] error-handling — Fire-and-forget showMainWindow can produce an unhandled rejection

void showMainWindow() (here and in the context-menu "Open Rome" handler at line 263) discards the returned promise. showMainWindow awaits createMainWindow(runtimeManager) on the path where the main window was destroyed; if that rejects, it surfaces as an unhandled rejection rather than a logged warning. Consider showMainWindow().catch((err) => log.warn(\Failed to raise the main window (${String(err)})`)) for parity with how the rest of this module handles async failures (refreshName` already logs). Low impact since the common path returns synchronously, but it keeps the log bundle honest.

@yunfanye yunfanye left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review: 💬 COMMENT

This PR adds a macOS-only floating Rome icon with renderer/main-process IPC, persisted geometry, tray integration, app-activation visibility handling, and updater/window fixes. The sender validation and separation of layout from native window management are solid, and the pure geometry/state helpers have focused tests.

I reviewed every changed file in full and traced the changed public symbols and IPC channels. Local typechecks/tests could not be rerun because this shallow clone has no installed dependencies (tsc: not found).

Verdict: COMMENT — The feature is well-structured overall, but several medium-severity lifecycle, security, and architecture issues should be addressed.

3 finding(s) posted as inline comments below.

Severity Category File Title
P2 design packages/desktop/src/main/floating-pill.ts One-time reveal leaves the icon visible while Rome remains active
P2 security packages/desktop/src/main/floating-pill.ts JSON parse errors can copy settings content into logs
P2 architecture packages/desktop/src/main/index.ts Main-window raising now has another divergent implementation

Automated review by RomeOS Code Review · commit 23c782b

// Ticked in the tray while Rome is frontmost, the icon would be hidden the
// moment it exists, and the tick would look like it did nothing. Show it
// this once; the next time Rome becomes active hides it as usual.
if (revealOnce && !created.isDestroyed() && !isQuitting()) created.showInactive();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] design — One-time reveal leaves the icon visible while Rome remains active

When the icon is enabled while Rome is already active, this calls showInactive(), but closing the tray menu does not emit another did-become-active event. The always-on-top icon therefore remains over Rome until the user switches away and back, violating the stated “hidden while Rome is frontmost” invariant. Make the feedback transient and call syncVisibility() afterward when romeActive, or acknowledge the toggle without showing the persistent panel.

name = next;
if (win && !win.isDestroyed()) win.webContents.send("pill:name", name);
} catch (err) {
log.warn(`Failed to refresh the agent name (${String(err)})`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] security — JSON parse errors can copy settings content into logs

response.json() can throw a SyntaxError whose message includes part of the invalid response, and String(err) writes that message to disk even though the response may contain sensitive settings. Log only a non-content-bearing error category such as err.name, or parse through a boundary that deliberately redacts failures. A narrow endpoint returning only agentName would further reduce exposure.

}
},
);
const showMainWindow = async (): Promise<void> => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] architecture — Main-window raising now has another divergent implementation

This adds another implementation of “bring Rome forward,” and it already differs from the tray path: this callback restores minimized windows and always calls show(), while tray.ts does neither consistently. Thus “Open Rome” from the pill and “Show Rome” from the tray can behave differently for the same window state. Consolidate this into one helper/callback and reuse it from the pill, tray, activation, second-instance, and protocol entry points.

@Jessie-QingYu Jessie-QingYu left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Code Review: 💬 COMMENT

This PR adds an opt-in, always-on-top macOS "floating pill" — the Rome mark plus the agent's name — that appears whenever Rome is not the frontmost app, raises the main window on click, drags freely, and persists its position. It is implemented as a non-focusable panel BrowserWindow driven from a new floating-pill.ts in the main process, with the pure geometry/parsing logic factored into a well-tested floating-pill-state.ts, a new pill entry in the base-web renderer, and a one-way pill:* IPC bridge. Two small out-of-feature edits accompany it: createSettingsWindow() now restores/shows before focusing, and getDialogWindow() in updater.ts skips always-on-top windows.\n\nThe quality of thought here is high — the sender-identity guard on every IPC handler, the app-activation (rather than window-focus) visibility rule, the click-vs-drag decision at release, the range validation on the stored position so a bad value can't kill bootstrap, and the platform gate are all well reasoned and unusually well documented. I read every changed file in full plus the call sites (tray.ts, index.ts, window.ts, manager.ts, lifecycle.ts, the core /api/settings route, and the renderer build config) and found no P0/P1 issues. My findings are mostly about coupling and cost: the agent-name refresh refetches the guardian's whole settings map on every app switch without throttling or in-flight dedupe; showMainWindow becomes a third divergent copy of "raise the main window" while the tray's copy still has the bug the new comment describes; and the enabled flag has two sources of truth with a swallowed write failure. The rest are P3 hardening and test-coverage notes.

Verdict: COMMENT — Well-designed, carefully documented feature with no blocking defects; the P2s (unthrottled full-settings refetch, duplicated window-raising logic, dual source of truth for the enabled flag) are worth fixing before merge but none of them break the feature.

8 finding(s) posted as inline comments below.

Severity Category File Title
P2 performance packages/desktop/src/main/floating-pill.ts refreshName refetches the whole settings map on every app switch, unthrottled
P2 architecture packages/desktop/src/main/index.ts Third copy of "raise the main window", and the tray's copy still has the bug this one fixes
P2 design packages/desktop/src/main/floating-pill.ts Pill enabled state has two sources of truth and a swallowed write failure
P3 security packages/desktop/src/main/floating-pill.ts refreshName trusts isReady() for the dashboard URL, which can be the port-80 placeholder
P3 error-handling packages/desktop/src/main/floating-pill.ts IPC geometry payloads are only checked for finiteness, not range
P3 code-quality packages/desktop/src/main/floating-pill.ts The 316-line orchestrator has no tests
P3 security packages/desktop/src/preload/index.ts The pill IPC surface is exposed to every window, including remote origins
P3 design packages/desktop/src/main/floating-pill-state.ts The macOS 27 gate has no escape hatch

Automated review by RomeOS Code Review · commit 23c782b

void created.loadFile(PILL_HTML);
};

const refreshName = async (): Promise<void> => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P2] performance — refreshName refetches the whole settings map on every app switch, unthrottled

refreshName() runs on every did-resign-active, and did-resign-active fires each time the user leaves Rome — ⌘-tab, clicking another window, opening Spotlight. Each run is a full GET /api/settings, which on the server side is settingsRepo.getAll() + redaction of the guardian's entire settings map (the comment here notes it carries connector secrets), all to read one string that changes maybe once a month.

There is also no in-flight dedupe: rapid app switching starts N overlapping requests, each holding a 5s timeout, and the last one to resolve wins — so a slow early response can overwrite a fresher late one.

Suggest guarding with a short TTL plus a single in-flight promise, e.g.:

let inFlight: Promise<void> | null = null;
let fetchedAt = 0;
const NAME_TTL_MS = 60_000;

const refreshName = (): Promise<void> => {
  if (inFlight) return inFlight;
  if (Date.now() - fetchedAt < NAME_TTL_MS) return Promise.resolve();
  inFlight = doRefreshName().finally(() => { inFlight = null; fetchedAt = Date.now(); });
  return inFlight;
};

Longer term a narrow endpoint (or reusing the value the dashboard already has) would avoid pulling a secret-bearing payload into the main process at all.

}
},
);
const showMainWindow = async (): Promise<void> => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P2] architecture — Third copy of "raise the main window", and the tray's copy still has the bug this one fixes

showMainWindow is now the fourth place in this file that implements "get-or-create the main window and raise it" (setupProtocolHandler.ensureMainWindow, setupTray.ensureMainWindow, app.on("activate"), second-instance), and its comment documents a real rule the others do not follow: show() must be called even when the window is already visible, because focus() alone can leave it behind the frontmost app.

tray.ts's showWindow does exactly the rejected thing (if (!existing.isVisible()) existing.show(); existing.focus();), so clicking the tray icon from another app has the bug the pill path was written to avoid — and the two will keep drifting.

Suggest making showMainWindow the single entry point: pass it to setupTray as one showMainWindow option (dropping getMainWindow/ensureMainWindow) and to the pill, so the raise rule lives in one place.


const isEnabled = (): boolean => isPillEnabled(readSetting(PILL_ENABLED_KEY));

const setEnabled = (enabled: boolean): void => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P2] design — Pill enabled state has two sources of truth and a swallowed write failure

isEnabled() reads the DB row while the actual on-screen state is "does win exist". writeSetting catches and only logs its error, so if the write fails setEnabled(true) still creates the window, the tray checkbox re-reads false and renders unticked next to a visible icon, and the icon is gone after restart — with nothing surfaced to the user.

It also means a synchronous SQLite read on every tray menu rebuild (which happens on every runtime status event).

Suggest keeping the authoritative value in memory and letting the DB be persistence only:

let enabled = isPillEnabled(readSetting(PILL_ENABLED_KEY));
const isEnabled = () => enabled;
const setEnabled = (next: boolean): void => {
  enabled = next;
  writeSetting(PILL_ENABLED_KEY, next ? "true" : "false");
  ...
};


const refreshName = async (): Promise<void> => {
// With the icon turned off there is nowhere to show a name.
if (!win || win.isDestroyed() || !runtimeManager.isReady()) return;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P3] security — refreshName trusts isReady() for the dashboard URL, which can be the port-80 placeholder

getDashboardUrl() falls back to http://127.0.0.1 (port 80) when localProxy is null — manager.ts calls this out explicitly and offers isServing() as the check that does not trust a stale phase. This is the first credentialed background request keyed off isReady() alone; cookies are not port-scoped, so in that window the dashboard session cookie would be handed to whatever is listening on 127.0.0.1:80.

Today closeLocalProxy() only runs after the phase moves to stopping, so the window looks unreachable — but it is a cheap guard to keep it that way:

const dashboardUrl = runtimeManager.getDashboardUrl();
if (!win || win.isDestroyed() || !runtimeManager.isReady()) return;
if (new URL(dashboardUrl).port === "") return; // placeholder, no proxy yet

// one thing taken from the page is where inside the window the pointer went
// down: the press can be delivered late, after the cursor has already moved
// on, so the cursor's position at this moment says nothing about the grab.
ipcMain.on("pill:dragStart", (event, grabX: number, grabY: number) => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P3] error-handling — IPC geometry payloads are only checked for finiteness, not range

floating-pill-state.ts deliberately rejects out-of-range coordinates because "the window APIs throw on a non-finite or out-of-range number" and an uncaught throw is fatal. The IPC path only checks Number.isFinite, so pill:dragStart with e.g. 1e300 (or pill:setSize with 1e300) would reach setPosition/setSize and throw inside an ipcMain handler in the main process.

The fromPill guard makes this unreachable from remote origins, so this is consistency rather than an exploit — but the same isUsableCoordinate helper is already exported and would close the gap in one line per handler. Likewise pill:setSize should bound the reported size (a runaway value makes an always-on-top transparent window that swallows every click).

}
}

export function setupFloatingPill(options: FloatingPillOptions): FloatingPill {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P3] code-quality — The 316-line orchestrator has no tests

Extracting the pure helpers into floating-pill-state.ts and testing them is the right call, but everything with a behavioural rule attached lives in setupFloatingPill and is untested: the fromPill sender guard (the security boundary for a preload API exposed to remote origins), the romeActive → syncVisibility rule, the revealOnce path, and the drag/click offset math.

Most of this is testable if the Electron surface is injected rather than imported — e.g. take { screen, createWindow, fetch } as options — and fromPill in particular is worth pinning down with a test that a sender other than the pill's webContents is ignored.


// One-way on purpose: the pill never needs an answer, and the main process
// owns all window geometry — the page only reports gestures.
pill: {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P3] security — The pill IPC surface is exposed to every window, including remote origins

As the comment on fromPill notes, the main window loads this same preload and navigates to remote origins (provider sign-in, checkout), so window.rome.pill.* exists on those pages. The fromPill check makes that harmless today, but it is a single if standing between a third-party page and "move/resize an always-on-top window and pop a native menu".

A dedicated preload/pill.js that exposes only the pill bridge (and points the pill window at it) would make the capability structurally unreachable from remote content, rather than reachable-but-rejected. Cheap now, much cheaper than after the next channel is added.

* mid-gesture. Off there until that is fixed upstream or checked on a machine.
* Darwin's major version runs one behind macOS's: Darwin 26 is macOS 27.
*/
export function supportsFloatingPill(platform: string, osRelease: string): boolean {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P3] design — The macOS 27 gate has no escape hatch

supportsFloatingPill hard-codes darwinMajor < 26. When macOS 27 ships, every user who had the icon enabled loses it on OS upgrade — the tray checkbox disappears too, so there is no affordance explaining where it went, only a log line. And re-enabling it (once electron/electron#53889 is fixed or verified) requires a desktop release.

Consider an env override (ROME_DESKTOP_FLOATING_PILL=1) so it can be exercised on a macOS 27 machine without a build, and — if the setting is on but the platform is unsupported — a one-time notice or at least a log.warn distinguishing "you turned this on and we disabled it" from "never enabled".

@Jessie-QingYu
Jessie-QingYu merged commit 9f26ea1 into main Sep 21, 2026
15 of 21 checks passed
@Jessie-QingYu
Jessie-QingYu deleted the desktop-floating-pill branch September 21, 2026 18:10
zoolsher added a commit that referenced this pull request Oct 23, 2026
…1281)

## What this PR does

On macOS 26.6, every press on the floating icon activates Rome. Becoming
active hides the icon, so a trackpad drag (three-finger or
press-and-drag) never starts. Rome comes to the front instead. A click
looked fine only because activation raises Rome anyway. The icon's page
never received the press.

The cause is
[electron/electron#53889](electron/electron#53889).
Electron's `type: "panel"` window reports the non-activating style from
its `styleMask` getter but never sets it, so the window server activates
the app on the press. The issue reports this on macOS 27, which is why
#462 keeps the icon off there. A trace on macOS 26.6.2 shows the same
thing for trackpad presses. The upstream fix
([electron/electron#54807](electron/electron#54807),
open) applies only to macOS 27.

This sets AppKit's `_setPreventsActivation:` on the icon's window once,
through koffi, before the window is shown.

## Design & Invariants

- Pressing, clicking or dragging the icon leaves the frontmost app
frontmost. Only a click raises Rome, through the icon's own click
handling.
- The private method is called only after `respondsToSelector:` confirms
it exists. If a macOS release drops it, the icon goes back to activating
Rome, Rome logs a warning, and nothing crashes.
- The native FFI module loads only when the icon window is created,
which happens only on macOS. Other platforms never open it.
- The packaged app carries koffi's loader and its two macOS binaries
(2.8 MB), not its sources or the other platforms' binaries (29 MB).

Considered and rejected: a small native addon in the repo, which adds a
native build step for one message send; and turning the icon off on
macOS 26.6 and later until upstream ships a fix, which removes the
feature.

## Test plan

- [x] macOS 26.6.2, real trackpad, debug build with event logging:
before the change, a click, a three-finger drag and a press-and-drag
each logged an app activation and no `pointerdown`. After it, 11 of 11
drags were recognized as drags with no activation, and a click opened
Rome through the icon's click handler.
- [x] Unpacked dev build, synthetic mouse drags with Finder frontmost:
the icon follows the cursor exactly and Finder stays frontmost.
- [x] Packaged unsigned `.app` (`electron-builder --dir`): koffi loads
from `app.asar.unpacked`, 3 of 3 drags move the icon with Finder
frontmost, and a click brings Rome to the front.
- [x] Unit tests: the flag is set, and nothing is sent when the method
is missing or the view has no window.
- [ ] Signed and notarized build. The existing entitlements already
allow unsigned executable memory and disable library validation.

Exercised on a MacBook (macOS 26.6.2, Electron 44.9.3) with a separate
profile. Synthetic drags were posted as CGEvents.

## Not in this PR

- macOS 27 stays off in `supportsFloatingPill`. This fix may cover it
too, but it has not been run there.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.

3 participants