Skip to content

Add niri compositor support#97

Open
abloch wants to merge 3 commits intoAlfredoSequeida:mainfrom
abloch:add-niri-support
Open

Add niri compositor support#97
abloch wants to merge 3 commits intoAlfredoSequeida:mainfrom
abloch:add-niri-support

Conversation

@abloch
Copy link
Copy Markdown

@abloch abloch commented Apr 15, 2026

Summary

  • Adds a WindowSystem implementation for the niri scrollable-tiling Wayland compositor
  • Uses niri's IPC (niri msg -j focused-window / focused-output) to query window metadata and output geometry
  • Registers niri in the compositor detection and import paths

Details

Niri supports the wlr-layer-shell protocol required by hints for overlay positioning. The implementation queries niri's JSON IPC for:

  • focused window: pid, app_id, window size, tile layout info
  • focused output: logical position, dimensions, scale

Window position is derived from tile_pos_in_workspace_view when 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 — new Niri(WindowSystem) class
  • hints/window_systems/window_system_type.py — added "niri" to SupportedWindowSystems
  • hints/hints.py — added niri to detection set and import match

Test plan

  • Verified niri msg -j focused-window returns expected data (pid, app_id, layout with tile/window sizes)
  • Verified Niri() class instantiates and returns correct extents on a live niri session (niri 25.11)
  • Verified auto-detection finds niri process and routes to the correct class
  • Ran hints -v — AT-SPI backend invoked, overlay coordinates passed correctly

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>
@gazpachoking
Copy link
Copy Markdown

gazpachoking commented Apr 15, 2026

tile_pos_in_workspace_view seems to be null for anything but floating windows. The niri IPC doesn't give enough info to determine where the focused window is on the screen for tiled windows.

See #68 and niri-wm/niri#2381

abloch and others added 2 commits April 20, 2026 18:23
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>
@abloch
Copy link
Copy Markdown
Author

abloch commented Apr 21, 2026

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants