Skip to content

feat(niri): full niri IPC transport, keybinds, config, capabilities, tests - #10

Open
TraNzeM wants to merge 6 commits into
Axenide:mainfrom
TraNzeM:niri-backend
Open

feat(niri): full niri IPC transport, keybinds, config, capabilities, tests#10
TraNzeM wants to merge 6 commits into
Axenide:mainfrom
TraNzeM:niri-backend

Conversation

@TraNzeM

@TraNzeM TraNzeM commented Aug 18, 2026

Copy link
Copy Markdown

Summary

Complete the niri backend of the Compositor abstraction. The existing niri adapter returned empty results because the IPC transport didn't match niri's actual protocol.

Changes

Transport (pkg/ipc/niri/client.go)

  • Fixed request encoding: niri expects {"Windows":null}, reply is {"Ok":{...}} (not wrapped in Reply)
  • Added requestQuery() to unwrap nested query responses ({"Windows":[...]})
  • Subscribe() now sends {"EventStream":null}, parses top-level events, skips {"Ok":"Handled"}
  • ListMonitors() parses the map-typed Outputs response

Features

  • BatchKeybinds/BindKey/UnbindKey — generate ambxst.kdl + include in config.kdl + reload (niri has no dynamic IPC binds)
  • SetConfig — generate ambxst-appearance.kdl + include + reload
  • GetConfig — read values back from the generated appearance file
  • GetCapabilitiesShadows: false (niri renders no shadows); added the missing System.GetCapabilities handler in server.go

Generator (pkg/ipc/niri/generator.go)

  • GenerateKeybindsFromPayload with Hyprland→niri dispatcher mapping
  • Extended appearance, layer-rules, startup, window-rules generators

Safety

  • ApplyConfig for niri writes to ambxst-generated.kdl + include — never overwrites the user's config.kdl

Tests (pkg/ipc/niri/client_test.go, new)

  • 7 tests against a fake niri Unix socket: ListWindows, ListWorkspaces, ListMonitors, ActiveWindow, GetCapabilities, BatchKeybinds, SetConfig

Verification

  • go build ./... OK, go test ./... OK (niri 7/7)
  • Runtime on live niri: window list, workspace list, monitor list all populate correctly

…tests

- Fix transport: request as {"Windows":null}, reply {"Ok":{...}}
- requestQuery for nested query unwrapping (Windows/Workspaces/Outputs)
- Subscribe with {"EventStream":null}, top-level events
- ListMonitors: parse map output (not slice)
- BatchKeybinds/BindKey/UnbindKey via ambxst.kdl + include + reload
- SetConfig via ambxst-appearance.kdl + include + reload
- GetConfig from generated appearance file
- GetCapabilities with Shadows=false (niri has no shadows)
- Add System.GetCapabilities handler in server.go
- Add client_test.go (7 tests via fake niri socket)
niri-port added 4 commits August 18, 2026 12:21
niri's Outputs query has no 'focused' flag, so ListMonitors returned
IsFocused=false for every output. That left AxctlService.focusedMonitor
null, which made Visibilities.setActiveModule('') no-op — the overview
could not be closed. Query Workspaces and mark the output hosting the
focused workspace as focused.
- ListWindows: parse layout.window_size into metadata width/height so the
  QML overview can render real-size previews (niri has no absolute position)
- ListMonitors: also track the active workspace per output and expose it via
  metadata.active_workspace, so the overview can center/highlight correctly
- Extend TestListMonitors to assert active_workspace
niri returns Workspaces in arbitrary order; sort by idx (metadata.index)
so the Ambxst overview scrolling column matches the real workspace order.
niri does not export NIRI_SOCKET into the environment of spawn-at-startup
children, so axctl daemon failed with 'no supported compositor detected'
when started automatically. Fall back to globbing XDG_RUNTIME_DIR for
niri*.sock. This makes autostart work without manual env setup.
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.

1 participant