Add niri compositor support#97
Conversation
Adds a WindowSystem implementation for the niri scrollable-tiling Wayland compositor. Uses niri's IPC (niri msg) to query focused window metadata and output geometry for hint overlay positioning. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
See #68 and niri-wm/niri#2381 |
tile_pos_in_workspace_view is only populated for floating windows; for tiled windows niri IPC does not expose the screen position (upstream issue niri-wm/niri#2381). The previous heuristic (centering a single column) was unreliable for multi-column layouts. Fall back to the full output geometry so hints still scans the screen correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Good catch, thanks! You're right — is only populated for floating windows. I've replaced the unreliable centering heuristic with a fallback to the full output geometry when is null. For tiled windows, hints will now scan the entire output rather than guessing an incorrect window position. Tracking the upstream fix at niri-wm/niri#2381 — once niri exposes tiled window positions we can tighten this up. |
|
Hey! Thank you for adding niri and mango support! So I know that #68 exists, and a lot of the niri implementation seems similar. I know that MR was not merged because there were some issues with gaps and other things. so a few questions.
I know that has been sitting for a while mainly because of the issues I saw, but I'm ok with merging it as is knowing that there are limitations on the niri side that we need to wait for anyways. |
|
Yeah this is essentially same as my implementation (although not sure what mangowm is or how it relates to niri). Their implementation is already a cleaned up implementation with the niri ipc limits in consideration, while mine still contains the attempt on calculating tiled window position which is pointless. I say this one could be merged instead of mine. |
Summary
WindowSystemimplementation for the niri scrollable-tiling Wayland compositorniri msg -j focused-window/focused-output) to query window metadata and output geometryDetails
Niri supports the wlr-layer-shell protocol required by hints for overlay positioning. The implementation queries niri's JSON IPC for:
Window position is derived from
tile_pos_in_workspace_viewwhen available (multi-column layouts), falling back to computing position from output geometry and tile offsets for single-column layouts.Files changed
hints/window_systems/niri.py— newNiri(WindowSystem)classhints/window_systems/window_system_type.py— added"niri"toSupportedWindowSystemshints/hints.py— added niri to detection set and import matchTest plan
niri msg -j focused-windowreturns expected data (pid, app_id, layout with tile/window sizes)Niri()class instantiates and returns correct extents on a live niri session (niri 25.11)niriprocess and routes to the correct classhints -v— AT-SPI backend invoked, overlay coordinates passed correctly