Repository navigation
friglet-tray: left click opens the window; top-bar popup on Hyprland/Omarchy (SNB-656) - #39
Merged
Merged
Conversation
…(SNB-656) - Linux tray uses tray-icon's KSNI backend: the item exports ItemIsMenu=false, so SNI hosts (Omarchy's bar, KDE, ...) send a left click as Activate; the menu stays on right click. macOS/Windows: menu on right click only. Left click opens the window everywhere. - No StatusNotifierWatcher at startup (tray before the bar at login): the tray keeps running and retries the icon (2 s doubling to 30 s) instead of failing setup. - Under Hyprland (HYPRLAND_INSTANCE_SIGNATURE) the window is a popup: undecorated, fixed 420x600 (min = max), right-aligned gaps_out/2 under the bar. Before each show a Lua window rule is registered over the IPC socket so it maps in place; after the show it is checked in j/clients (class learned and logged) and moved by dispatch if needed (legacy dispatchers without the Lua API). Left click toggles; Esc and focus loss hide. While open, other windows get no_follow_mouse so hovering them (Omarchy: follow_mouse = 1) does not steal focus and close the popup. - README: Linux tray note and an Omarchy/Hyprland section with an optional static rule; AGENTS.md headless tray notes updated for KSNI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes SNB-656: on Omarchy 4 (Hyprland, Quickshell bar) a left click on the friglet-tray icon did nothing, and the status window opened as an ordinary tiled window.
Stacked on #37 (
snb-658-tray-controls-errors-logs), which reworks friglet-tray heavily. The branch starts at #37's head (10a15b0). #37 merged intointegration(017131a) while this was in progress and its branch was deleted, so this PR targetsintegrationdirectly. It merges cleanly with the currentintegration, which also contains #34–#36.Why left click did nothing
Tauri's tray uses tray-icon's libappindicator backend on Linux. libayatana never exports
ItemIsMenu, and it rejectsActivatewhen no handler is connected. Omarchy's bar sendsActivate(0, 0)on a left click unless the item is menu-only (shell/plugins/bar/widgets/Tray.qml:832-841), so the click was dropped. blindbit-desktop (fyne.io/systray) gets clicks differently: it implements StatusNotifierItem itself over D-Bus. With no tap handler it setsItemIsMenu=true, so a left click there opens its menu.Changes
friglet-tray/Cargo.tomlturns on tray-icon'sksnifeature. Tauri still enableslibappindicator; when both are on, tray-icon uses KSNI.ItemIsMenu=false, so a host sends a left click asActivate. That arrives asTrayIconEvent::Click { Left, Up }.show_menu_on_left_clickis nowfalseso the menu is on right click there too.friglet-tray/src/popup.rs). It is on only whenHYPRLAND_INSTANCE_SIGNATUREis set and talks to$XDG_RUNTIME_DIR/hypr/$SIG/.socket.sockdirectly. It writes no config files.j/cursorpos,j/monitors(bar height fromreserved[1]) andgeneral:gaps_out. The panel goes right-aligned,gaps_out / 2below the bar and from the right edge, which is the geometry of Omarchy'sKeyboardPanel. It shrinks on short screens.evalregistershl.window_rule({ match = { title, class? }, float, size, move = { "(monitor_w-window_w-N)", top } }), so the window maps in place. The previous rule is disabled first, Omarchy'somarchy-launch-aboutpattern: Hyprland has no rule removal, and re-registering a named rule appends effects. The rule is only re-sent when it changes.no_follow_mouse. Omarchy setsfollow_mouse = 1, so without it, moving the pointer off the popup would focus the window underneath and close the popup. A click still moves focus (InputManager.cpp:704-707,897-912at Hyprland 586c01e). Hiding, Esc, quit and the next start all turn the rule off.j/clientsby PID and learns its class. That class goes into later rules and is logged at info: "Hyprland window class of the status window". If the window is not where planned, the tray floats, resizes and moves it withhl.dsp.window.*, or with the legacysetfloating/resizewindowpixel/movewindowpixeldispatchers when Hyprland has no Lua API.j/activewindow: a dropdown of ours, the network<select>, leaves our window active in Hyprland.Verification
All builds were debug builds.
cargo test --workspacepassed. friglet-tray now has 67 unit tests (16 new inpopup.rs) plus 9 e2e.cargo clippy --no-deps -p friglet-ipc -p friglet-tray --all-targets -- -D warningsis clean (the CI lint, minusfriglet, which this PR does not touch), andcargo fmt -p friglet-tray -- --checkpasses.Unit tests against a fake Hyprland socket. The fake reads each request to EOF, records it and answers like Hyprland. The tests cover:
eval is only supported with the lua config manager), which gets the legacy dispatchers only and no furthereval;Pure tests cover placement (scale, transform, monitor offset, reserved right edge, small screens), the
cssandcustomgap replies and escaping.End to end under Xvfb. The setup was a private D-Bus session, a stand-in StatusNotifierWatcher and host that follows Omarchy's
Tray.qmlclick rules (left:ActivateunlessItemIsMenu; right: dbusmenu), the fake daemon, and a fake Hyprland socket that applies rules and dispatches to the X11 windows with xdotool. Clicks were real X pointer clicks on the stand-in tray icon.ItemIsMenu=False. Left click →Activate→ the window opens. A second left click keeps it open. Right click shows the menu. "Start scanning" from the menu works, and the menu then shows Start disabled and Stop enabled.gaps_out10.Not verified
movesemantics and reply strings come from Hyprland's source at 586c01e and v0.56.2 and from Omarchyquattro@ c05d901, but nothing ran against a live compositor. Unverified there:hl.window_ruleaccepts exactly these tables;friglet-tray, logged at runtime.ItemIsMenu=false.testjob and the Linux, macOS (universal dmg) and Windows (msi/nsis) packaging jobs are green. The new socket code iscfg(unix), with a stub otherwise.