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
feat(island): adjust island top offset when taskbar is positioned at screen top (#956)
Ohualtexcc9ea86554be
diff --git a/windows/src-tauri/src/island.rs b/windows/src-tauri/src/island.rsindex b7cf9213..cee78bd7 100644--- a/windows/src-tauri/src/island.rs+++ b/windows/src-tauri/src/island.rs@@ -329,6 +329,11 @@ mod zoom_tests {assert_eq!(calculate_zoom_correction(1.0, f64::NAN, 1.0), None);assert_eq!(calculate_zoom_correction(1.0, 1.0, f64::INFINITY), None);}++ #[test]+ fn top_taskbar_offset_defaults_safely() {+ assert!(platform::top_taskbar_offset(0, 0, 1920, 1080) >= 0);+ }}@@ -363,7 +368,8 @@ pub fn apply_geometry(app: &AppHandle, pref: &str, collapsed: bool) {let pw = (lw * scale).round().max(1.0) as u32;let ph = (lh * scale).round().max(1.0) as u32;let x = mp.x + (ms.width as i32 - pw as i32) / 2;- let y = mp.y;+ let top_offset = platform::top_taskbar_offset(mp.x, mp.y, ms.width, ms.height);+ let y = mp.y + top_offset;// GTK never sizes a non-resizable window below its natural size (200 px// here), so on Linux the 6 px wake strip would stay a 200 px block. tao@@ -404,7 +410,8 @@ fn current_screen_key(app: &AppHandle) -> Option<(i32, i32, u32, u32, u64)> {let m = target_monitor(app, &pref)?;let p = m.position();let size = m.size();- Some((p.x, p.y, size.width, size.height, m.scale_factor().to_bits()))+ let top = platform::top_taskbar_offset(p.x, p.y, size.width, size.height);+ Some((p.x, p.y + top, size.width, size.height, m.scale_factor().to_bits()))}/// Emits `cursor` (window-logical coordinates) at ~60 Hz while the island isdiff --git a/windows/src-tauri/src/platform/linux.rs b/windows/src-tauri/src/platform/linux.rsindex f451eefa..e52c1e82 100644--- a/windows/src-tauri/src/platform/linux.rs+++ b/windows/src-tauri/src/platform/linux.rs@@ -534,6 +534,11 @@ pub fn pin_to_monitor(win: &WebviewWindow, x: i32, y: i32) {unsafe { layer::gtk_layer_set_monitor(gtk_window_ptr(&gw), mon_ptr) };}+/// Top taskbars only dock on Windows (layer-shell on Linux anchors to screen edge).+pub fn top_taskbar_offset(_mx: i32, _my: i32, _mw: u32, _mh: u32) -> i32 {+ 0+}+/// 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 e850ae55..5c6973c2 100644--- a/windows/src-tauri/src/platform/windows.rs+++ b/windows/src-tauri/src/platform/windows.rs@@ -10,7 +10,7 @@ use tauri::{AppHandle, Manager, WebviewWindow};use ::windows::core::{w, BOOL, PWSTR};use ::windows::Win32::Foundation::{- CloseHandle, HANDLE, HLOCAL, HWND, LPARAM, LocalFree, POINT, RPC_E_CHANGED_MODE,+ CloseHandle, HANDLE, HLOCAL, HWND, LPARAM, LocalFree, POINT, RECT, RPC_E_CHANGED_MODE,};use ::windows::Win32::Security::Authorization::ConvertSidToStringSidW;use ::windows::Win32::Security::{GetTokenInformation, TokenUser, TOKEN_QUERY, TOKEN_USER};@@ -29,13 +29,15 @@ use ::windows::Win32::UI::Input::KeyboardAndMouse::{VK_CONTROL, VK_LBUTTON, VK_MENU, VK_SHIFT,};use ::windows::Win32::UI::Shell::{+ SHAppBarMessage, APPBARDATA, ABM_GETTASKBARPOS, ABE_TOP,ShellExecuteExW, SHELLEXECUTEINFOW, SEE_MASK_FLAG_NO_UI, SEE_MASK_NOASYNC,};use ::windows::Win32::UI::WindowsAndMessaging::{EnumChildWindows, EnumWindows, GetClassNameW, GetCursorPos, GetWindow, GetWindowLongPtrW,GetWindowTextW, GetWindowThreadProcessId, IsIconic, IsWindowVisible, SetForegroundWindow,- SetWindowLongPtrW, ShowWindow, GWL_EXSTYLE, GW_OWNER, SW_RESTORE, SW_SHOWNORMAL, WS_EX_NOACTIVATE,- WS_EX_TOOLWINDOW,+ SetWindowLongPtrW, ShowWindow, SystemParametersInfoW, GWL_EXSTYLE, GW_OWNER, SW_RESTORE,+ SW_SHOWNORMAL, WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW, SPI_GETWORKAREA,+ SYSTEM_PARAMETERS_INFO_UPDATE_FLAGS,};use super::LocalTime;@@ -359,6 +361,44 @@ pub fn set_pointer_watch(_active: bool) {}/// `set_position` already places a Win32 window on the right display.pub fn pin_to_monitor(_win: &WebviewWindow, _x: i32, _y: i32) {}+/// Returns the height of a taskbar docked at the top of the monitor (in physical px).+/// Returns 0 if there is no taskbar at the top.+pub fn top_taskbar_offset(mx: i32, my: i32, mw: u32, _mh: u32) -> i32 {+ let mut abd = APPBARDATA {+ cbSize: std::mem::size_of::<APPBARDATA>() as u32,+ ..Default::default()+ };+ let res = unsafe { SHAppBarMessage(ABM_GETTASKBARPOS, &mut abd) };+ if res != 0 {+ let is_top = abd.uEdge == ABE_TOP || (abd.rc.top <= my + 5 && abd.rc.bottom > my);+ let mid_x = mx + (mw as i32 / 2);+ let on_this_monitor = abd.rc.left <= mid_x && abd.rc.right >= mid_x;+ if is_top && on_this_monitor {+ let height = (abd.rc.bottom - my).max(0);+ if height > 0 && height < 200 {+ return height;+ }+ }+ }++ if my == 0 {+ let mut work = RECT::default();+ let ok = unsafe {+ SystemParametersInfoW(+ SPI_GETWORKAREA,+ 0,+ Some(&mut work as *mut _ as *mut _),+ SYSTEM_PARAMETERS_INFO_UPDATE_FLAGS(0),+ )+ };+ if ok.is_ok() && work.top > 0 && work.top < 200 {+ return work.top;+ }+ }++ 0+}+// ── Session windows ("Open terminal") ─────────────────────────────────────────//// See session_window.rs: the relay's ancestors lead to the terminal or editor