A Wayland window can't place itself. Under niri the panel opened where niri
floats a new window, the middle of the output. Hyprland already had an
adapter (omarchy/hypr.go); niri now has one too.
niri (checked in niri v26.04's source, niri-ipc/src/lib.rs and
src/ipc/server.rs) can't add window rules at runtime and doesn't report the
pointer over IPC. So omarchy.NiriPanel watches niri's event stream
($NIRI_SOCKET, one line of JSON per message) and moves each window of
magpie's pid titled "magpie panel" once as it opens:
MoveWindowToFloating if it was tiled, then MoveFloatingWindow with SetFixed
x/y, which count from the working area's top-left (below the bar). It goes 6
px under the bar, centred on the x that the tray host passed to the SNI
Activate(x, y), kept inside the output. Wails' Linux tray keeps that x in
private fields (lastClickX/lastClickY), read the same way trayProps already
reads props; TestTrayClickIsWails reads Wails' source to fail if they move.
Noctalia passes bar-surface-local coordinates, so the x is taken across
the focused output. With no click (`magpie panel`), or with one off the
output, it goes to the top right. Wails' HideOnFocusLost closes it when
another window takes the focus.
What was run:
- go test -race ./internal/omarchy/, go test ./internal/gui/ (sandbox
HOME, pinned GOMODCACHE/GOCACHE). The IPC fixtures are built from
niri-ipc 26.4.0's Window/Output/Event/Reply types, quoted in the test.
- Broke it by hand: dropping the placed-once map fails TestWatchWindows
(placed [7 7 9 9 9]); dropping the right-edge clamp fails TestPanelSpot.
- gofmt -l; go vet (darwin), GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...; linux nogui and windows builds.
- A nested niri 26.04 (winit backend on Xvfb, scale 1.5, Fedora 43
container, magpie built with -tags gtk3), with SNI Activate sent via
dbus-send. Activate(300, 14) put the panel at [58, 6] (300 - 484/2).
A second Activate closed it. `magpie panel` reopened it at the top right
(853 - 484 - 6 = 363). Activate(800, 14) clamped it to 363. `magpie gui`
taking the focus closed it.
Not tried: a real niri desktop, Noctalia or another real tray host
(Waybar, ironbar), more than one monitor, a bar at the bottom or the side
(not accounted for), focus-follows-mouse. The panel still opens in the
middle and slides up; how visible that is on real hardware wasn't seen.
Not from this change: omarchy's TestCurrent fails with -count=2 on main
(it passes with -count=1).
Red on ubuntu and macOS CI since 884dbdb2 ("open pkg/application/
systemtray_linux.go: no such file or directory"): go list -m -f {{.Dir}}
prints nothing when the module's source isn't in the cache, so the path
was relative. go mod download -json unpacks it and names its Dir.
Run: go test ./internal/gui -run TestTrayMenu with the normal cache, and
TestTrayMenuOpenFrameIsWails with an empty GOMODCACHE (CI's case): both ok.
gofmt, go vet ./internal/gui.
Wails (v3 beta.24, systemtray_linux.go) calls the tray's click handler
both for the icon's click (Activate) and from the dbusmenu "opened" event,
when the tray host opens the icon's menu. KDE Plasma opens the menu on a
right-click, so the right-click also opened the quick panel, which took
the focus, and on Wayland the menu shut at once (it stayed under
GDK_BACKEND=x11, as the reporter saw). On Linux the click handler now
ignores a call whose callers include Wails' (*linuxSystemTray).Event
(menuOpening, trayclick.go); a left-click (Activate) opens the panel as
before. Wails has no public hook for the menu opening.
Run: TestTrayMenuOpeningIsNoClick fails with openedBy broken ("a click
from the menu's opened event was counted a click") and passes;
TestTrayMenuOpenFrameIsWails reads the Wails module's source and fails if
Event stops calling the click handler on "opened" or is renamed.
go test -tags nogui ./internal/gui/ under a temp HOME passes; gofmt -l
clean; go vet (darwin, with the GUI) and GOOS=linux/windows go vet -tags
nogui ./internal/gui/ pass; GOOS=linux go build -tags nogui passes.
Not tried on a real KDE Plasma 6 Wayland session: no KDE machine here.