88b4c00ea11c8653cada22e11edf20ab1594de43
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f131117976 |
gui: on niri the tray panel opens under the bar beside the clicked icon, not in the middle of the screen (#1670, Kenoia)
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). |
||
|
|
d7b1d9df41 |
gui: with Settings' Bar icon on, Omarchy's bar shows one magpie, not the widget and the tray icon side by side (Alex on Discord)
On Omarchy the tray's StatusNotifierItem is always registered, so a user who had magpie in the bar's tray and turned on Bar icon got the widget beside it: two magpies. Wails has no Hide on Linux (a no-op), so the item now says Status "Passive" while the widget is in (set through Wails' own properties, as the tooltip is, with NewStatus sent), and "Active" again once it is taken out. Omarchy's Tray.qml leaves Passive items out of both its pinned row and drawer (bucket()), as waybar's tray does; Omarchy itself hides Dropbox's tray item when its Dropbox widget is in the bar. The status is set when the app starts (from whether the widget is in) and whenever Settings' Bar icon adds or removes it (onBarIcon), from what is in the bar afterwards even if the omarchy command failed. TestBarIconTellsTheTray (POST /api/omarchy/widget on, then off, with stand-in omarchy commands) fails with the call taken out: "Bar icon on: the tray was told [], want [true]"; passes with it, -race -count=10. On the omarchy VM (Omarchy 4.0.4 shell): a test SNI item pinned in the bar showed when Active, was gone within a second of Passive + NewStatus and came back on Active. This build (go build -tags gtk3 on the VM, vet clean), run in a sandbox HOME with MAGPIE_OMARCHY=1: with the widget's files in its config the tray item's Status read "Passive" over busctl, without them "Active". Not run on the VM: turning the switch at runtime (the route is covered by the test). go test -race ./internal/gui ./internal/omarchy, gofmt, vet, darwin/linux nogui/windows builds pass. |
||
|
|
bd45fa452a | gui: Linux tray quotas reach the bar's tooltip (atie on Discord: on Omarchy, hovering magpie's tray icon showed no quota with 设置 › 用量 › 菜单栏显示额度 on, after opening the panel and restarting) — Wails v3.0.0-beta.24's Linux SetTooltip is a "TBD" no-op: the StatusNotifierItem's ToolTip stayed the {title: "magpie"} it was made with and no NewToolTip was ever sent, so every bar showed "magpie" (Omarchy's bar shows tooltipTitle before Title, waybar ToolTip before Title too, and waybar reads ToolTip again only on NewToolTip). magpie now sets the ToolTip itself after Wails' SetTooltip: through the prop.Properties Wails exported (reached by reflection, so the (sa(iiay)ss) type it was made with is kept and PropertiesChanged goes out), then sends org.kde.StatusNotifierItem.NewToolTip from the same session-bus connection. The quotas go in the title, the part both Omarchy's bar and waybar show; waybar reads it as Pango markup, so &, < and > become look-alikes (sniTip) rather than losing the whole tooltip. Until the tray is up (or should a Wails update move the field) the loop tries again next time. TestSNITipIsSafeMarkup covers the markup. In the omarchy VM (Omarchy 4, Quickshell bar), built there with -tags "production gtk3", in a sandbox HOME with the VM's DeepSeek and Kimi balance keys: the released magpie's item kept ToolTip "magpie" (Title "¥79.15 | $8.83"); this build's ToolTip is (sa(iiay)ss) "DeepSeek · ¥79.15\n\nKimi · $8.83", dbus-monitor shows PropertiesChanged then NewToolTip from the item's connection, and hovering its icon in Omarchy's bar shows both balances. Waybar itself wasn't run (the VM's Omarchy 4 has none); what it does is from its source (sni/item.cpp). go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass but TestProvidersAnswerWhileListsComeIn and TestClaudeSignedOut, timing tests that pass alone. |