diff --git a/mac/Sources/Wind/AppDelegate.swift b/mac/Sources/Wind/AppDelegate.swift
index 85855dd2..63d9e908 100644
--- a/mac/Sources/Wind/AppDelegate.swift
+++ b/mac/Sources/Wind/AppDelegate.swift
@@ -272,6 +272,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
private func setUpPanel() {
panel.currentConfig = { [weak self] in self?.mag.config ?? Config() }
+ mag.panelEscape = { [weak self] in self?.panel.escapeFromTap() ?? false }
panel.save = { [weak self] c in self?.saveConfig { $0 = c } }
panel.macStatus = { [weak self] in self?.macStatusDict() ?? [:] }
panel.perf = { [weak self] in (self?.mag.level ?? 1, self?.mag.tickRing.samples ?? []) }
diff --git a/mac/Sources/Wind/Magnifier.swift b/mac/Sources/Wind/Magnifier.swift
index 0453be48..ba084e53 100644
--- a/mac/Sources/Wind/Magnifier.swift
+++ b/mac/Sources/Wind/Magnifier.swift
@@ -35,6 +35,10 @@ final class Magnifier {
private var lastButtonAt: CFTimeInterval = -1e9
private var lastKeyAt: CFTimeInterval = -1e9
private var keyAfterButton = false
+ /// Esc while the menu bar panel is open: returns true when the panel took it (closed). The panel
+ /// does not always get keys itself (macOS may refuse to activate Wind), so Wind's tap closes it.
+ var panelEscape: (() -> Bool)?
+ private var swallowEscUp = false
private var mouseDx = 0.0, mouseDy = 0.0 // movement since the last tick (for the owner)
private var lastMoveAt: CFTimeInterval = 0
private var pendingLockDx = 0.0, pendingLockDy = 0.0
@@ -319,6 +323,11 @@ final class Magnifier {
case .keyDown, .keyUp:
let code = UInt16(e.getIntegerValueField(.keyboardEventKeycode))
lastKeyAt = now
+ if code == 0x35 { // Esc: the menu bar panel's, when open
+ if type == .keyDown, mods.isEmpty, e.getIntegerValueField(.keyboardEventAutorepeat) == 0,
+ panelEscape?() == true { swallowEscUp = true; return nil }
+ if type == .keyUp, swallowEscUp { swallowEscUp = false; return nil }
+ }
if type == .keyDown {
if !mods.contains(.cmd) && !mods.contains(.ctrl) { keyAfterButton = true }
let (sw, ed) = router.triggerDown(.key(code), mods: mods,
diff --git a/mac/Sources/Wind/MenuBarPanel.swift b/mac/Sources/Wind/MenuBarPanel.swift
index aefbae12..bc161724 100644
--- a/mac/Sources/Wind/MenuBarPanel.swift
+++ b/mac/Sources/Wind/MenuBarPanel.swift
@@ -10,11 +10,10 @@ import WindCore
// order Settings > Menu bar sets (menu* keys, MenuLayout). The page is ui/panel.html (Svelte, the same
// wind://ui/ files and bridge as Settings) in a WKWebView inside a borderless panel. Built on the first
// open and then kept, hidden, so later opens show at once. Placement and the re-open guard are pure
-// (WindCore/MenuPanel.swift). Lessons from Universal Clipboard's Mac panel (7ed027a, 3bb6252): activate
-// the app on open or WebKit gets no mouse-moved events (no hover, no tooltips); no native shadow, the
-// page draws it; close on focus loss, Esc, a second icon click, Settings and Quit. A close Wind itself
-// caused (Esc, the icon, the page's close) hands activation back to the app that had it, so the text
-// field Wind follows keeps its keystrokes.
+// (WindCore/MenuPanel.swift). Opening asks macOS to activate Wind (the page then has the keyboard) and a close
+// Wind caused hands activation back; macOS may refuse, so the panel is non-activating and key anyway, Wind's
+// own pointer tracking (PanelPointerView) draws hover and tooltips, and Esc also reaches Wind's event tap.
+// No native shadow, the page draws it; close on focus loss, Esc, a second icon click, Settings and Quit.
//
// Page -> host (webkit.messageHandlers.wind): panelSize {h}; getConfig; setConfig {key, value};
// setConfigs {values}; getMacStatus; panelAction {action: close | openSettings | quit | openPrivacy |
@@ -22,6 +21,29 @@ import WindCore
// Host -> page (window.__windReceive): config {values, push}; macStatus {...}; perf {level, ms[]};
// panel {open}. First paint: window.__windInit {values, mac, perf}.
+/// Tracks the pointer over the panel whether or not Wind is the active app, and hands its place to the
+/// page (`window.__windPointer`), which draws hover and tooltips from it. WebKit sends hover and shows
+/// `title` tooltips only while its window is key in the active app; a status item click does not always
+/// leave Wind active, so the owner saw no hover on Settings/Quit and no tooltips (2026-11-23).
+final class PanelPointerView: NSView {
+ var onPointer: ((CGPoint?) -> Void)?
+ private var area: NSTrackingArea?
+ override func updateTrackingAreas() {
+ super.updateTrackingAreas()
+ if let area { removeTrackingArea(area) }
+ let a = NSTrackingArea(rect: .zero, options: [.mouseMoved, .mouseEnteredAndExited, .activeAlways, .inVisibleRect],
+ owner: self, userInfo: nil)
+ addTrackingArea(a); area = a
+ }
+ private func report(_ e: NSEvent) {
+ let p = convert(e.locationInWindow, from: nil)
+ onPointer?(CGPoint(x: p.x, y: bounds.height - p.y)) // page coordinates: top-left origin
+ }
+ override func mouseMoved(with e: NSEvent) { report(e) }
+ override func mouseEntered(with e: NSEvent) { report(e) }
+ override func mouseExited(with e: NSEvent) { onPointer?(nil) }
+}
+
/// Borderless, so it must say it can take key focus itself (the sliders want the arrow keys).
final class MenuPanelWindow: NSPanel {
var onEscape: (() -> Void)?
@@ -62,6 +84,7 @@ final class MenuBarPanelController: NSObject, WKScriptMessageHandler, WKNavigati
static let writeGap = 0.05
/// The control under the pointer (the page reports it), for the test state.
private(set) var hovered = ""
+
/// The app that was frontmost when the panel opened (nil when it was Wind), and whether Wind was active.
private var previousApp: NSRunningApplication?
private var wasActive = false
@@ -87,9 +110,10 @@ final class MenuBarPanelController: NSObject, WKScriptMessageHandler, WKNavigati
sendPerf()
send(["type": "panel", "open": true])
startPerf()
- // An accessory app is not activated by a status item click; without this WebKit gets no
- // mouse-moved events, so nothing on the page shows hover (Universal Clipboard 7ed027a). The
- // activation policy stays .accessory: no Dock icon. close() gives activation back.
+ // Ask to activate Wind so the page gets the keyboard (Tab, arrows on a slider); close() gives it back.
+ // macOS may refuse (measured 2026-11-23: keys went on to the frontmost app), so nothing else depends
+ // on it: the panel is non-activating and key either way (clicks land at once), PanelPointerView draws
+ // hover and tooltips, and Esc reaches Wind's event tap (escapeFromTap).
wasActive = NSApp.isActive
let front = NSWorkspace.shared.frontmostApplication
previousApp = front?.processIdentifier == ProcessInfo.processInfo.processIdentifier ? nil : front
@@ -129,6 +153,15 @@ final class MenuBarPanelController: NSObject, WKScriptMessageHandler, WKNavigati
Log.verbose("menu bar panel: closed (\(why))")
}
+ /// Esc seen by Wind's event tap (main thread) while the panel is open: it closes the panel and the key is
+ /// swallowed. Not left to the page: whether keys reach it cannot be told from here (2026-11-23: Wind read
+ /// as active and frontmost while macOS sent the keys on to the app behind, so Esc did nothing).
+ func escapeFromTap() -> Bool {
+ guard isOpen else { return false }
+ close("esc")
+ return true
+ }
+
/// After a close Wind caused, the app that was frontmost before the panel opened gets activation back.
/// Not on focus loss (another app already took it), Settings (it comes forward) or Quit, and not when
/// Wind was active already (its Settings window was in front).
@@ -170,7 +203,7 @@ final class MenuBarPanelController: NSObject, WKScriptMessageHandler, WKNavigati
web.underPageBackgroundColor = .clear
web.navigationDelegate = self
web.autoresizingMask = [.width, .height]
- let p = MenuPanelWindow(contentRect: rect, styleMask: [.borderless], backing: .buffered, defer: false)
+ let p = MenuPanelWindow(contentRect: rect, styleMask: [.borderless, .nonactivatingPanel], backing: .buffered, defer: false)
p.title = "Wind Menu Bar"
p.isFloatingPanel = true
p.level = .floating
@@ -182,7 +215,16 @@ final class MenuBarPanelController: NSObject, WKScriptMessageHandler, WKNavigati
p.becomesKeyOnlyIfNeeded = false
p.appearance = NSAppearance(named: .darkAqua)
p.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary, .transient, .ignoresCycle]
- p.contentView = web
+ let host = PanelPointerView(frame: rect)
+ host.autoresizesSubviews = true
+ web.frame = host.bounds
+ host.addSubview(web)
+ host.onPointer = { [weak self] pt in
+ let arg = pt.map { String(format: "%.1f,%.1f", $0.x, $0.y) } ?? "-1,-1"
+ self?.web?.evaluateJavaScript("window.__windPointer && window.__windPointer(\(arg))")
+ }
+ p.acceptsMouseMovedEvents = true
+ p.contentView = host
p.delegate = self
p.onEscape = { [weak self] in self?.close("esc") }
panel = p; self.web = web
diff --git a/mac/VERSION b/mac/VERSION
index ac39a106..f374f666 100644
--- a/mac/VERSION
+++ b/mac/VERSION
@@ -1 +1 @@
-0.9.0
+0.9.1
diff --git a/mac/docs/architecture.md b/mac/docs/architecture.md
index 4a0da7db..73c2a732 100644
--- a/mac/docs/architecture.md
+++ b/mac/docs/architecture.md
@@ -1249,14 +1249,22 @@ counterpart of Windows' tray flyout (`src/tray_app/flyout_*`), built without an
reaches the screen top, so the icon is what keeps the card out from under the revealed bar), clamped to the
screen's visible frame; the page reports its height (more while the
engine list hangs below the card) and the window is resized and placed again.
-- **Focus and hover:** an accessory app is not activated by a status item click, and without activation WebKit
- gets no mouse-moved events, so nothing shows hover (Universal Clipboard 7ed027a). Opening calls `NSApp.activate()`
- and makes the panel key; the activation policy stays `.accessory`.
+- **Focus and hover:** opening asks macOS to activate Wind (`NSApp.activate()`), so the page has the keyboard
+ (Tab, a slider's arrows); a close Wind caused (Esc, the icon, the page's close, the icon hidden) hands
+ activation back to the app that was frontmost (`giveBackFocus`), so the text field Wind follows keeps its
+ keystrokes. macOS refuses that activation now and then (2026-11-23, e2e_menubar: active false, key false; Esc
+ and the first slider drag went elsewhere, no hover on Settings/Quit and no tooltips for the owner), so nothing
+ else depends on it:
+ - the panel is a non-activating `NSPanel` (`.nonactivatingPanel`), key either way, so clicks land at once;
+ - WebKit draws hover and shows `title` tooltips only while its app is active, so `PanelPointerView` tracks the
+ pointer with an `.activeAlways` tracking area and calls `window.__windPointer(x, y)`; the page sets a `hov`
+ class (rules marked `:global`, or Svelte strips them) and draws its own tooltips from `data-tip` after 500 ms;
+ - keys may still go on to the app behind (Wind can read as active and frontmost meanwhile), so Esc is taken
+ by Wind's event tap while the panel is open (`Magnifier.panelEscape`, `escapeFromTap`): it closes the panel,
+ engine list and all, and is swallowed.
- **Closing:** focus loss (`windowDidResignKey`), Esc, a second icon click, Settings, Quit. A click on the icon
within 300 ms of a close is the click that closed it and does not reopen (`MenuPanel.ignoreClick`, Windows'
- kReopenGuardMs). A close Wind caused (Esc, the icon, the page's close, the icon hidden) gives activation back
- to the app that was frontmost when the panel opened (`giveBackFocus`), so the text field Wind follows keeps its
- keystrokes; not on focus loss, Settings or Quit, nor when Wind was active already.
+ kReopenGuardMs). Not on focus loss, Settings or Quit, nor when Wind was active already, is activation handed back.
- **Writes:** the page posts `setConfig` (sliders, already throttled to one per 50 ms with a flush on release by
the shared Slider), `setConfigs` (a toggle, both alignment keys at once) and `panelAction setEngine`. The host
types each with `SettingsWindowController.setting` and coalesces them: at most one `saveConfig` per 50 ms,
diff --git a/mac/scripts/e2e_menubar.py b/mac/scripts/e2e_menubar.py
index cb03e43b..7a41fed5 100755
--- a/mac/scripts/e2e_menubar.py
+++ b/mac/scripts/e2e_menubar.py
@@ -4,7 +4,7 @@
"""The menu bar panel ON SCREEN in the test build, with REAL input (tools/vmouse, Karabiner, sudo).
Opens the panel through the command channel (`panel open`), then checks: the card sits under the menu
bar icon (its right edge under the icon's right edge, its top 3 pt under the menu bar) and inside the
-screen's visible frame; Wind is active and the panel is key (or WebKit gets no hover); the real pointer
+screen's visible frame; the panel is key (activated or not); the real pointer
over a toggle segment changes its background and the page reports the hovered control; a real slider drag
and a real toggle click write config.json; Esc closes it; a real click outside closes it; a real click
on the icon opens it and a second one closes it; a real right-click on the icon opens the native menu
@@ -93,7 +93,8 @@ def esc(): vmc("type ^"); time.sleep(0.4)
f"card {card} visible {vis} icon {icon}")
check("it is inside the visible frame", card[0] >= vis[0] - 0.5 and card[0] + card[2] <= vis[0] + vis[2] + 0.5
and card[1] + card[3] <= vis[1] + vis[3] + 0.5, f"card {card} visible {vis}")
-check("Wind is active and the panel is key (hover needs it)", p["active"] and p["key"], f"active {p['active']} key {p['key']}")
+# Key whether or not macOS let Wind activate (the panel is non-activating; 2026-11-23).
+check("the panel is key", p["key"], f"active {p['active']} key {p['key']}")
loaded = until(lambda: js("return !!document.querySelector('.card .bar')"))
check("the page loaded", bool(loaded))
inner = js("const r = document.querySelector('.card').getBoundingClientRect(); return [r.x, r.y]")
@@ -133,6 +134,21 @@ def at(rect, fx=0.5): warp(ox + rect[0] + rect[2] * fx, oy + rect[1] + rect[3] /
warp(icon[0] + icon[2] / 2, icon[1] + icon[3] / 2); click()
check("a click on the icon opens the panel", until(lambda: panel()["open"]))
time.sleep(0.5)
+# Owner 2026-11-23: opened from the icon, Settings and Quit showed no hover and nothing said what the
+# icons were. Hover and tooltips come from Wind's own pointer tracking, so they work active or not.
+p = panel(); card = p["card"]
+inner = js("const r = document.querySelector('.card').getBoundingClientRect(); return [r.x, r.y]")
+ox, oy = card[0] - inner[0], card[1] - inner[1]
+for sel, text in (('.ib[data-id="settings"]', "Settings"), ('.ib[data-id="quit"]', "Quit Wind")):
+ at(js(RECT % sel)); vmc("move 1 0 2 16"); time.sleep(0.3)
+ hov = until(lambda: js(f"return document.querySelector('{sel}').classList.contains('hov')"))
+ bgc = js(f"return getComputedStyle(document.querySelector('{sel}')).backgroundColor")
+ check(f"{text}: hover from a real pointer after an icon click", bool(hov) and bgc != "rgba(0, 0, 0, 0)",
+ f"hov {hov} background {bgc}")
+ tip = until(lambda: js("const t = document.querySelector('[role=tooltip]'); return t && t.textContent"), timeout=2)
+ check(f"{text}: its tooltip names it", tip == text, f"tooltip {tip!r}")
+warp(icon[0] + icon[2] / 2, icon[1] + icon[3] / 2)
+time.sleep(0.3)
warp(icon[0] + icon[2] / 2, icon[1] + icon[3] / 2); click()
check("a second click on the icon closes it", until(lambda: not panel()["open"]))
time.sleep(0.5)
diff --git a/mac/ui/src/panel/Panel.svelte b/mac/ui/src/panel/Panel.svelte
index cbe88cf1..ec0f0bbe 100644
--- a/mac/ui/src/panel/Panel.svelte
+++ b/mac/ui/src/panel/Panel.svelte
@@ -100,13 +100,42 @@
return () => ro.disconnect();
});
- // ---- hover, for the e2e state (which control is under the real pointer)
- let hovered = '';
- function onOver(e) {
- const el = e.target instanceof Element ? e.target.closest('[data-id]') : null;
- const id = el ? el.dataset.id : '';
+ // ---- hover and tooltips. WebKit sends hover and shows `title` tooltips only while the panel is key
+ // in the active app, and a status item click does not always leave Wind active (owner 2026-11-23: no
+ // hover on Settings/Quit, no tooltips). So the host tracks the pointer itself and calls
+ // window.__windPointer(x, y) (page points, -1 when it leaves); the page's own pointer events feed the
+ // same function while it is active. Hover is the `hov` class, tooltips are drawn here from data-tip.
+ const HOVERABLE = '.seg button, .engine, .ib, .bfix, .elist li';
+ const TIP_DELAY = 500;
+ let hovered = ''; // data-id under the pointer, for the e2e state
+ let hovEl = null, tipFor = null, tipTimer = 0;
+ let tip = $state(null); // {text, x, y, below}
+ let tipEl = $state();
+ function pointerAt(x, y) {
+ const el = x < 0 ? null : document.elementFromPoint(x, y);
+ const h = el ? el.closest(HOVERABLE) : null;
+ if (h !== hovEl) { hovEl?.classList.remove('hov'); h?.classList.add('hov'); hovEl = h; }
+ const t = el ? el.closest('[data-tip]') : null;
+ if (t !== tipFor) {
+ tipFor = t; clearTimeout(tipTimer); tip = null;
+ if (t) tipTimer = setTimeout(() => showTip(t), TIP_DELAY);
+ }
+ const idEl = el ? el.closest('[data-id]') : null;
+ const id = idEl ? idEl.dataset.id : '';
if (id !== hovered) { hovered = id; post({ type: 'hover', id }); }
}
+ async function showTip(t) {
+ if (!card || !t.isConnected) return;
+ const r = t.getBoundingClientRect(), c = card.getBoundingClientRect();
+ const below = r.bottom + 34 <= c.bottom;
+ tip = { text: t.dataset.tip, x: r.left + r.width / 2, y: below ? r.bottom + 6 : r.top - 6, below };
+ await tick();
+ if (!tipEl || !tip) return;
+ const w = tipEl.offsetWidth, lo = c.left + 6 + w / 2, hi = c.right - 6 - w / 2;
+ tip = { ...tip, x: Math.min(Math.max(tip.x, lo), hi) };
+ }
+ function hideTip() { clearTimeout(tipTimer); tip = null; tipFor = null; }
+ window.__windPointer = pointerAt;
// ---- keys: Esc closes (the engine list first); Left/Right walk the toggle group
function onKey(e) {
@@ -190,8 +219,9 @@