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() # Get IDs of all workspaces print([i.id for i in niri.workspaces]) # Get the ID of the active workspace on eDP-1 print([i.id for i in niri.workspaces if i.is_active and i.output == "eDP-1"]) # Get the currently active keyboard layout print(niri.keyboard_layouts.current_name) # Get the title of the active window print(niri.active_window.title)
- signal workspace_added#
Emitted when a new workspace has been added.
- Parameters:
workspace (
NiriWorkspace
) -- The instance of the workspace.
- gproperty keyboard_layouts: NiriKeyboardLayouts#
read-only
The currenly configured keyboard layouts.
- gproperty windows: list[NiriWindow]#
read-only
A list of windows.
- gproperty active_window: NiriWindow#
read-only
The currenly focused window.
- gproperty workspaces: list[NiriWorkspace]#
read-only
A list of workspaces.
- send_command(cmd: dict | str) str #
Send a command to the Niri IPC.
- Parameters:
- Return type:
- Returns:
Response from Niri IPC.
- Raises:
NiriIPCNotFoundError -- If Niri IPC is not found.
- get_workspace_by_id(workspace_id: int) NiriWorkspace | None #
Get a workspace by its ID.
- Parameters:
workspace_id (
int
) -- The ID of the workspace.- Return type:
- Returns:
The workspace instance, or
None
if the workspace with the given ID doesn't exist.
- class ignis.services.niri.NiriKeyboardLayouts(*args: Any, **kwargs: Any)#
Configured keyboard layouts.
- class ignis.services.niri.NiriWindow(*args: Any, **kwargs: Any)#
A window.
- signal destroyed#
Emitted when the window has been destroyed.