Niri#

class ignis.services.niri.NiriService(*args: Any, **kwargs: Any)#

Niri IPC client.

Example usage:

from ignis.services.niri import NiriService

niri = NiriService.get_default()

print(niri.workspaces)
print(niri.kb_layout)

niri.connect("notify::kb-layout", lambda x, y: print(niri.kb_layout))
property is_available: bool#
  • read-only

Whether Niri IPC is available.

property workspaces: list[dict[str, Any]]#
  • read-only

A list of workspaces.

property active_workspaces: list[dict[str, Any]]#
  • read-only

The currently active workspaces.

property kb_layout: str#
  • read-only

The currenly active keyboard layout.

property active_window: dict[str, Any]#
  • read-only

The currenly focused window.

property active_output: dict[str, Any]#
  • read-only

The currenly focused output.

send_command(cmd: str) str#

Send a command to the Niri IPC.

Parameters:

cmd (str) -- The command to send.

Return type:

str

Returns:

Response from Niri IPC.

Raises:

NiriIPCNotFoundError -- If Niri IPC is not found.

switch_kb_layout() None#

Switch to the next keyboard layout.

Return type:

None

switch_to_workspace(workspace_id: int) None#

Switch to a workspace by its ID.

Parameters:

workspace_id (int) -- The ID of the workspace to switch to.

Return type:

None