Repository navigation
Closed
Description
Context
An app can open a panel with OpenPanel(PanelOptions{...}), but it cannot say where the panel goes or keep it from taking the keyboard. As of 27f4e39:
PanelOptionsholds onlyWidth,Height,HideOnBlurandMaterial(core/window.go:58-66).WindowhasShow,Hide,Toggle,FocusandClosebut no way to move it (core/window.go:218-264). The only placement isshowAt(tray), under a tray icon.- macOS:
NsgoPanelanswers YES tocanBecomeKeyWindow(internal/platform/macos/app.go:142-145), so a click in the panel makes it key and takes the keyboard from the app the user is typing in, even though the style mask includes non-activating. - Windows: an embedded view calls
SetFocuson every button-down (internal/platform/windows/windows.go:2172-2178), and nothing handlesWM_MOUSEACTIVATEor setsWS_EX_NOACTIVATE. - Linux:
setFrameignores the position (internal/platform/linux/system.go:612-614). That is right for an ordinary toplevel on Wayland, but there is no other surface kind an app could use instead.
#31 brought panels and tray icons to Windows and Linux; this issue is about a different kind of panel.
Why it matters
A whole class of desktop UI is a small surface placed next to something on screen that must never take the keyboard from the app underneath:
- an input method's candidate window, placed at the text caret of another app
- an on-screen keyboard, handwriting pad or emoji/symbol picker docked to a screen edge or near the caret
- a color picker loupe, a dictionary lookup popup, a screen annotation toolbar
Today such an app has to write these surfaces natively on every platform and leave NSGo for them. The rest of the app can be NSGo, but these panels are often where most of its UI lives.
Proposal
PanelOptions.Activates bool(default false keeps today's behavior for tray panels, or a separateNoActivatefield if the default should stay as is). When the panel must not activate:- macOS: a panel subclass whose
canBecomeKeyWindowreturns NO, withbecomesKeyOnlyIfNeeded. - Windows:
WS_EX_NOACTIVATE | WS_EX_TOPMOST | WS_EX_TOOLWINDOW, answerWM_MOUSEACTIVATEwithMA_NOACTIVATE, and skip theSetFocuson button-down. - Linux X11:
_NET_WM_WINDOW_TYPE_UTILITYor_NOTIFICATIONwith input hints off.
- macOS: a panel subclass whose
Window.ShowAt(rect Rect, edge Edge): shows the panel next to a screen rectangle in global points (for example under it, flipping above when it would leave the screen), andWindow.MoveTo(rect, edge)to follow the caret without hiding. On each desktop:- macOS:
setFrameOriginin screen coordinates on the screen that holds the rect. - Windows:
SetWindowPoswithSWP_NOACTIVATE, using the monitor that holds the rect and its DPI. - Linux X11:
gtk_window_moveor the X11 surface's position. - Linux Wayland: a regular toplevel cannot be placed, so this needs a layer-shell surface (
zwlr_layer_shell_v1, where the compositor has it) for edge-docked panels. A panel at another app's caret is only possible through the compositor's input-method protocol, so on WaylandShowAtshould report that it cannot place the panel instead of silently ignoring the rect.
- macOS:
- A way for the app to learn that placement failed (a returned error or a
Placed()bool), so it can choose another UI.
Acceptance
- On macOS and Windows, a non-activating panel shown with
ShowAtwhile another app's text field has the focus appears at the given rect. Clicking a button in it runs the handler, and the other app's text field keeps the keyboard and its caret. MoveTorepositions a visible panel without a flash or a focus change, on a second monitor with a different scale factor too.- On Linux X11 the same holds. On Wayland with layer-shell, an edge-docked panel works; without it,
ShowAtreports that it could not place the panel. nsgotestcan assert a panel's frame and that showing it did not change the focused window.
Metadata
Metadata
Assignees
Labels
No labels
Activity
houko commentedon Nov 15, 2026
Another concrete case for this issue, checked at
aadbe7e: a dictionary app's quick-lookup panel. A global shortcut opens aHideOnBlurpanel, and the app wants it next to the mouse pointer rather than in the upper middle of the screen. #243 already lists "a dictionary lookup popup" under Why it matters. This adds two things it does not cover yet: how the current placement code interacts withSetWindowFrame, and the fact that the app has no public way to get the point it would pass toShowAt.What happens today
WindowShowgoes throughshowtoshowPanel(internal/platform/macos/app.go:200-206), andWindowOrderFrontcallsshowPanelfor panels too (internal/platform/macos/desktop.go:131-137).showPanelputs the panel under its tray icon, or else readsNSEvent mouseLocationonly to pick the screen and then centers the panel two thirds up it beforesetFrameOrigin(internal/platform/macos/app.go:211-250). Windows does the same inWindowShowandWindowOrderFront(internal/platform/windows/chrome.go:281-302) throughplacePanel, which readsGetCursorPosonly to pick the monitor (internal/platform/windows/system.go:864-887).Togglegoes throughFocus, so it places the panel again too (core/window.go:239-257).desktop.SetWindowFramewithMovesent beforeShowis silently overwritten. One sent from the panel's own content scope afterShowlands, because both go on the panel's command list in order (core/desktop.go:13-18, core/desktop.go:36-40, core/window.go:208-221). That only works by accident of ordering. The app has to keep the contentcxaround and send the frame again after everyShow,FocusandToggle, and nothing promises the panel will not first appear at the default spot for a moment. NeitherSetWindowFrame's doc (desktop/desktop.go:157-163) nordocs/architecture/application.md:82says that showing a panel discards its frame.NSEvent mouseLocation,GetCursorPos), but only inside the platform layers.core,desktopandEnvexport nothing for it:Env.Displaysgives display frames only (core/env.go:280),EventHotKeycarries only the shortcut ID (internal/driver/events.go:228-229), andPopupMenu's point is in surface coordinates. To place a panel at the pointer, the app has to callNSEvent mouseLocationthrough purego and flip y against the main screen on macOS, and callGetCursorPosand convert physical pixels into NSGo's point space withEnv.Displayson Windows. That is the same platform code NSGo already has internally, written again in every app.OpenWindowwithFrame.Move, gets a taskbar button on Windows (SkipTaskbaris still a roadmap row,docs/roadmap.md:107), and the app has to hide it on blur itself.Minimal repro
On macOS and Windows the first frame is discarded. The panel ends up at 200,200 only because of the second call.
Proposal (additions to the proposal above)
ShowAt(or aPanelOptionsplacement field) take the pointer as its anchor, for exampleShowAt(desktop.AtPointer, edge), so the backend that already readsNSEvent mouseLocationandGetCursorPosuses that point instead of only the screen. Where the rect is known it should be a global rect inSetWindowFrame's coordinate space, as proposed above.desktop.PointerLocation(cx) (core.Point, bool)in the same coordinate space asSetWindowFrameandEnv.Displays. It would report false on Wayland and on platforms without a global pointer.SetWindowFramebeforeShowis known to be lost.Acceptance
ToggleandFocuson that panel keep the placement the app asked for, with no need to resend a frame.SetWindowFramewould need to put the panel's top-left corner at the pointer, and reports false on Wayland.docs: describe placed and non-activating panels and what #243 still n…
docs: describe placed and non-activating panels and what #243 still n…
docs: describe placed and non-activating panels and what #243 still n…
houko commentedon Nov 20, 2026
The current source now covers the requested panel behavior.
PanelOptions.NoActivateprovides non-activating panels,Window.ShowAtandMoveToplace and follow a screen-space anchor,Show,FocusandTogglepreserve placement, andOnPlacementErrorreports platforms such as Wayland that cannot place the panel. The Windows, macOS and Linux backends contain the corresponding placement/non-activation paths. I am closing this issue as resolved by the current implementation.