Skip to content

Usage⚓︎

Quick start and examples.

Install⚓︎

Install from PyPI or the AUR:

# PyPI
pip install niripy
poetry add niripy
uv add niripy

# AUR
yay -S python-niripy
paru -S python-niripy

Or use Nix with the provided flake:

nix develop github:kjmcnamara1/niripy

Examples⚓︎

Instance is the main class for interacting with Niri. It attaches to the Niri socket and provides methods for querying and controlling Niri.

The models returned (e.g. Windows, Outputs, Workspaces) are all pydantic models!

from niripy.instances import Instance

niri = Instance()

print(niri.version)

for window in niri.get_windows():
    print(window.title)
    print(window.model_dump_json(indent=2))