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
fix(island): read the top taskbar from the display's work area (#956)
Claudef1c6c6b86ea9
diff --git a/windows/src-tauri/src/island.rs b/windows/src-tauri/src/island.rsindex cee78bd7..c9e24c6f 100644--- a/windows/src-tauri/src/island.rs+++ b/windows/src-tauri/src/island.rs@@ -331,8 +331,14 @@ mod zoom_tests {}#[test]- fn top_taskbar_offset_defaults_safely() {- assert!(platform::top_taskbar_offset(0, 0, 1920, 1080) >= 0);+ fn a_top_taskbar_moves_the_island_down_and_nothing_else_does() {+ // Taskbar at the bottom (or none): the work area starts at the top.+ assert_eq!(top_inset_from(0, 0), 0);+ // A 48 px taskbar at the top of a display placed at y = -1080.+ assert_eq!(top_inset_from(-1080, -1032), 48);+ // Nonsense from the system never pushes the island off the display.+ assert_eq!(top_inset_from(0, -20), 0);+ assert_eq!(top_inset_from(0, 900), 0);}}@@ -356,6 +362,23 @@ pub fn screen_info(app: &AppHandle, pref: &str) -> ScreenInfo {}/// Places and sizes the window. `collapsed` picks the wake strip instead of the panel.+/// Windows: how far a taskbar docked at the top of this display (or another+/// app bar there) pushes the island down, read from the display's work area,+/// so the island sits under it (#956). An auto-hidden taskbar takes no work+/// area and moves nothing. Linux anchors the island to the screen edge: 0.+fn top_inset(m: &tauri::Monitor) -> i32 {+ if cfg!(windows) {+ top_inset_from(m.position().y, m.work_area().position.y)+ } else {+ 0+ }+}++fn top_inset_from(monitor_y: i32, work_y: i32) -> i32 {+ let inset = work_y - monitor_y;+ if (0..200).contains(&inset) { inset } else { 0 }+}+pub fn apply_geometry(app: &AppHandle, pref: &str, collapsed: bool) {let Some(win) = window(app) else { return };let Some(m) = target_monitor(app, pref) else { return };@@ -368,8 +391,7 @@ 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 top_offset = platform::top_taskbar_offset(mp.x, mp.y, ms.width, ms.height);- let y = mp.y + top_offset;+ let y = mp.y + top_inset(&m);// 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@@ -410,8 +432,7 @@ 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();- 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()))+ Some((p.x, p.y + top_inset(&m), 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 e52c1e82..f451eefa 100644--- a/windows/src-tauri/src/platform/linux.rs+++ b/windows/src-tauri/src/platform/linux.rs@@ -534,11 +534,6 @@ 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 5c6973c2..e850ae55 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, RECT, RPC_E_CHANGED_MODE,+ CloseHandle, HANDLE, HLOCAL, HWND, LPARAM, LocalFree, POINT, RPC_E_CHANGED_MODE,};use ::windows::Win32::Security::Authorization::ConvertSidToStringSidW;use ::windows::Win32::Security::{GetTokenInformation, TokenUser, TOKEN_QUERY, TOKEN_USER};@@ -29,15 +29,13 @@ 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, SystemParametersInfoW, GWL_EXSTYLE, GW_OWNER, SW_RESTORE,- SW_SHOWNORMAL, WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW, SPI_GETWORKAREA,- SYSTEM_PARAMETERS_INFO_UPDATE_FLAGS,+ SetWindowLongPtrW, ShowWindow, GWL_EXSTYLE, GW_OWNER, SW_RESTORE, SW_SHOWNORMAL, WS_EX_NOACTIVATE,+ WS_EX_TOOLWINDOW,};use super::LocalTime;@@ -361,44 +359,6 @@ 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