Skip to content

Initialize Niri state on startup #30

@tokyob0t

Description

@tokyob0t

Is your feature request related to a problem? Please describe.

Currently, niri.vala does not initialize its state when a Niri instance is created. As a result, properties such as workspaces, windows, outputs, and focused objects remain empty until IPC events are received.

This makes it difficult to access the current state immediately after calling Niri.get_default().

Describe the solution you'd like

Add an initialization step similar to AstalHyprland, where Niri performs an initial IPC sync and populates its fields before the instance is exposed.

This would allow consumers to access a fully populated state right after initialization.

Describe alternatives you've considered

The current workaround is to wait for events or perform IPC queries manually, which duplicates logic already handled by the library.

Additional context

AstalHyprland already implements this behavior:

hyprland.vala

Implementing something similar in AstalNiri would provide a more consistent and predictable API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions