A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.
Swift ai-agentsanthropicantigravityclaudeclaude-codecodexcursordynamic-islandgemini-cliiosiphonlinuxmacosmacos-appmenubar-appnotchopen-sourceswiftswiftuiwindows
Settings: choose which display the island lives on
chux4207be9e82f8
diff --git a/windows/src-tauri/src/island.rs b/windows/src-tauri/src/island.rsindex ad184e76..0ce036da 100644--- a/windows/src-tauri/src/island.rs+++ b/windows/src-tauri/src/island.rs@@ -114,16 +114,51 @@ fn monitor_contains(m: &Monitor, x: f64, y: f64) -> bool {&& y < (p.y + s.height as i32) as f64}-/// A display's logical origin: GDK monitor geometry is in logical pixels.+/// A display's logical origin, the key `at:<x>,<y>` preferences are matched on.+/// Names are no good for that: two monitors of the same model share one.fn logical_origin(m: &Monitor) -> (i32, i32) {let scale = m.scale_factor();let p = m.position();((p.x as f64 / scale).round() as i32, (p.y as f64 / scale).round() as i32)}-/// The display the island lives on: the primary one, or the one under the cursor.+/// One entry of the "Island lives on" list in Settings.+#[derive(Serialize, Clone)]+pub struct MonitorChoice {+ pub key: String,+ pub label: String,+}++pub fn monitor_choices(app: &AppHandle) -> Vec<MonitorChoice> {+ let Ok(monitors) = app.available_monitors() else { return Vec::new() };+ monitors+ .iter()+ .map(|m| {+ let (x, y) = logical_origin(m);+ let scale = m.scale_factor();+ let s = m.size();+ let w = (s.width as f64 / scale).round();+ let h = (s.height as f64 / scale).round();+ let name = m.name().cloned().unwrap_or_else(|| "Display".into());+ MonitorChoice { key: format!("at:{x},{y}"), label: format!("{name} — {w}×{h} at {x},{y}") }+ })+ .collect()+}++/// The display the island lives on: a chosen one, the primary one, or the one+/// under the cursor.fn target_monitor(app: &AppHandle, pref: &str) -> Option<Monitor> {let monitors = app.available_monitors().ok()?;+ if let Some((x, y)) = pref+ .strip_prefix("at:")+ .and_then(|r| r.split_once(','))+ .and_then(|(x, y)| Some((x.trim().parse::<i32>().ok()?, y.trim().parse::<i32>().ok()?)))+ {+ // Unplugged or rearranged since: fall back to the primary display.+ if let Some(m) = monitors.iter().find(|m| logical_origin(m) == (x, y)) {+ return Some(m.clone());+ }+ }if pref == "cursor" {if let Some((cx, cy)) = cursor_physical() {if let Some(m) = monitors.iter().find(|m| monitor_contains(m, cx, cy)) {diff --git a/windows/src-tauri/src/lib.rs b/windows/src-tauri/src/lib.rsindex 714103e5..2c523370 100644--- a/windows/src-tauri/src/lib.rs+++ b/windows/src-tauri/src/lib.rs@@ -124,6 +124,12 @@ fn reposition(app: AppHandle, shared: State<Shared>) {island::apply_geometry(&app, &pref, collapsed);}+/// The displays the island can be pinned to, for Settings.+#[tauri::command]+fn list_monitors(app: AppHandle) -> Vec<island::MonitorChoice> {+ island::monitor_choices(&app)+}+#[tauri::command]fn open_url(url: String) {if !(url.starts_with("http://") || url.starts_with("https://")) {@@ -381,6 +387,7 @@ pub fn run() {set_island_rect,focus_window,reposition,+ list_monitors,open_url,open_in_vscode,quit_app,diff --git a/windows/src/core/bridge.ts b/windows/src/core/bridge.tsindex 24aaf55f..32775da8 100644--- a/windows/src/core/bridge.ts+++ b/windows/src/core/bridge.ts@@ -50,6 +50,9 @@ export const Bridge = {reposition: () => call<void>("reposition"),+ /** Displays the island can be pinned to: `key` is what `settings.screen` stores. */+ listMonitors: () => call<{ key: string; label: string }[]>("list_monitors"),+openUrl: (url: string) => call<void>("open_url", { url }),/** "Open terminal" → opens the folder in VS Code when `code` is on PATH. */diff --git a/windows/src/core/state.ts b/windows/src/core/state.tsindex 01236b80..4b1b2335 100644--- a/windows/src/core/state.ts+++ b/windows/src/core/state.ts@@ -87,7 +87,8 @@ export interface Settings {autoCloseInterval: number;absenceInterval: number;activeIntegrations: string[];- screen: "primary" | "cursor";+ /** "primary", "cursor", or `at:<x>,<y>` for one display (logical origin). */+ screen: string;autostart: boolean;hooksInstalled: boolean;/** Claude model used by the chat. */diff --git a/windows/src/settings/main.ts b/windows/src/settings/main.tsindex 3ab9ab94..2e8a02a3 100644--- a/windows/src/settings/main.ts+++ b/windows/src/settings/main.ts@@ -387,8 +387,14 @@ function generalSection(): HTMLElement {h("option", { value: "cursor", text: "Display under the cursor" }),);screen.value = settings.screen;+ void Bridge.listMonitors().then((list) => {+ for (const m of list ?? []) screen.append(h("option", { value: m.key, text: m.label }));+ // Set again now the option exists; a display that is gone shows as the main one.+ screen.value = settings.screen;+ if (!screen.value) screen.value = "primary";+ });screen.addEventListener("change", () => {- settings.screen = screen.value as Settings["screen"];+ settings.screen = screen.value;void save();});