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
Linux: pin the layer-shell island to its display
chux83b30879afca
diff --git a/windows/src-tauri/src/island.rs b/windows/src-tauri/src/island.rsindex 92c9cd4c..ad184e76 100644--- a/windows/src-tauri/src/island.rs+++ b/windows/src-tauri/src/island.rs@@ -114,6 +114,13 @@ 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.+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.fn target_monitor(app: &AppHandle, pref: &str) -> Option<Monitor> {let monitors = app.available_monitors().ok()?;@@ -172,6 +179,8 @@ pub fn apply_geometry(app: &AppHandle, pref: &str, collapsed: bool) {let _ = win.set_resizable(true);let _ = win.set_size(PhysicalSize::new(pw, ph));let _ = win.set_position(PhysicalPosition::new(x, y));+ let (lx, ly) = logical_origin(&m);+ platform::pin_to_monitor(&win, lx, ly);// Moving across displays can rescale the window: re-assert the physical size.let _ = win.set_size(PhysicalSize::new(pw, ph));let _ = win.set_always_on_top(true);diff --git a/windows/src-tauri/src/platform/linux.rs b/windows/src-tauri/src/platform/linux.rsindex e748a336..eeab9736 100644--- a/windows/src-tauri/src/platform/linux.rs+++ b/windows/src-tauri/src/platform/linux.rs@@ -181,6 +181,7 @@ mod layer {pub fn gtk_layer_set_anchor(window: *mut GtkWindow, edge: c_int, anchor: c_int);pub fn gtk_layer_set_exclusive_zone(window: *mut GtkWindow, zone: c_int);pub fn gtk_layer_set_keyboard_mode(window: *mut GtkWindow, mode: c_int);+ pub fn gtk_layer_set_monitor(window: *mut GtkWindow, monitor: *mut gtk::gdk::ffi::GdkMonitor);}}@@ -263,6 +264,30 @@ pub fn make_non_activating(win: &WebviewWindow) {crate::log::line("island is a layer-shell overlay");}+/// Puts the layer surface on the display whose logical origin is (`x`, `y`).+///+/// A layer surface ignores `set_position`: without an explicit output the+/// compositor maps it on whichever display has focus at that moment, so on a+/// multi-monitor Hyprland or Sway desktop the island wandered from one screen+/// to the other every time it was remapped. A no-op for a regular window, which+/// `set_position` already places.+pub fn pin_to_monitor(win: &WebviewWindow, x: i32, y: i32) {+ if !LAYER_SURFACE.load(Ordering::Relaxed) {+ return;+ }+ let Ok(gw) = win.gtk_window() else { return };+ let display = gw.display();+ let monitor = (0..display.n_monitors())+ .filter_map(|i| display.monitor(i))+ .find(|m| {+ let g = m.geometry();+ g.x() == x && g.y() == y+ });+ let Some(monitor) = monitor else { return };+ let mon_ptr: *mut gtk::gdk::ffi::GdkMonitor = monitor.to_glib_none().0;+ unsafe { layer::gtk_layer_set_monitor(gtk_window_ptr(&gw), mon_ptr) };+}+/// Temporarily allow keyboard focus so a text field inside the island can be/// typed in.pub fn set_activating(win: &WebviewWindow, activating: bool) {diff --git a/windows/src-tauri/src/platform/windows.rs b/windows/src-tauri/src/platform/windows.rsindex 6e1200a8..fe4bcae2 100644--- a/windows/src-tauri/src/platform/windows.rs+++ b/windows/src-tauri/src/platform/windows.rs@@ -233,3 +233,6 @@ pub fn set_activating(win: &WebviewWindow, activating: bool) {/// Click-through here is the poll's WS_EX_TRANSPARENT toggle, not a region.pub fn set_input_region(_win: &WebviewWindow, _rect: Option<(f64, f64, f64, f64)>) {}++/// `set_position` already places a Win32 window on the right display.+pub fn pin_to_monitor(_win: &WebviewWindow, _x: i32, _y: i32) {}