Hyprland#

class ignis.services.hyprland.HyprlandService(*args: Any, **kwargs: Any)#

Hyprland IPC client.

Example usage:

from ignis.services.hyprland import HyprlandService

hyprland = HyprlandService.get_default()

# Get IDs of all workspaces
print([i.id for i in hyprland.workspaces])

# Get the ID of the active workspace
print(hyprland.active_workspace.id)

# Get the currently active keyboard layout
print(hyprland.main_keyboard.active_keymap)

# Get the title of the active window
print(hyprland.active_window.title)
signal workspace_added#

Emitted when a new workspace has been added.

Parameters:

workspace (HyprlandWorkspace) -- The instance of the workspace.

signal window_added#

Emitted when a new window has been added.

Parameters:

window (HyprlandWindow) -- The instance of the window.

signal monitor_added#

Emitted when a new monitor has been added.

Parameters:

monitor (HyprlandMonitor) -- The instance of the monitor.

gproperty is_available: bool#
  • read-only

Whether Hyprland IPC is available.

gproperty workspaces: list[HyprlandWorkspace]#
  • read-only

A list of workspaces.

gproperty active_workspace: HyprlandWorkspace#
  • read-only

The currently active workspace.

gproperty main_keyboard: HyprlandKeyboard#
  • read-only

The main keyboard.

gproperty windows: list[HyprlandWindow]#
  • read-only

A list of windows.

gproperty active_window: HyprlandWindow#
  • read-only

The currenly focused window.

gproperty monitors: list[HyprlandMonitor]#
  • read-only

A list of monitors.

send_command(cmd: str) str#

Send a command to the Hyprland IPC. Supports the same commands as hyprctl. If you want to receive the response in JSON format, use this syntax: j/COMMAND.

Parameters:

cmd (str) -- The command to send.

Return type:

str

Returns:

Response from Hyprland IPC.

Raises:

HyprlandIPCNotFoundError -- If Hyprland IPC is not found.

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

get_workspace_by_id(workspace_id: int) HyprlandWorkspace | None#

Get a workspace by its ID.

Parameters:

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

Return type:

HyprlandWorkspace | None

Returns:

The workspace instance, or None if the workspace with the given ID doesn't exist.

get_window_by_address(address: str) HyprlandWindow | None#

Get a window by its address.

Parameters:

address (str) -- The address of the window.

Return type:

HyprlandWindow | None

Returns:

The window instance, or None if the window with the given address doesn't exist.

get_monitor_name(name: str) HyprlandMonitor | None#

Get a monitor by its name.

Parameters:

name (str) -- The name of the monitor.

Return type:

HyprlandMonitor | None

Returns:

The monitor instance, or None if the monitor with the given name doesn't exist.

get_windows_on_workspace(workspace_id: int) list[HyprlandWindow]#

Get a list of windows on a workspace by its ID.

Parameters:

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

Return type:

list[HyprlandWindow]

Returns:

A list of windows on the workspace.

class ignis.services.hyprland.HyprlandWorkspace(*args: Any, **kwargs: Any)#

A workspace.

signal destroyed#

Emitted when the workspace has been destroyed.

gproperty id: int#
  • read-only

The ID of the workspace.

gproperty name: str#
  • read-only

The name of the workspace.

gproperty monitor: str#
  • read-only

The monitor on which the workspace is placed.

gproperty monitor_id: int#
  • read-only

The ID of the monitor on which the workspace is placed.

gproperty windows: int#
  • read-only

The amount of windows on the workspace.

gproperty has_fullscreen: bool#
  • read-only

Whether the workspace has a fullscreen window.

gproperty last_window: str#
  • read-only

The latest window.

gproperty last_window_title: str#
  • read-only

The latest window title.

switch_to() None#

Switch to this workspace.

Return type:

None

class ignis.services.hyprland.HyprlandWindow(*args: Any, **kwargs: Any)#

A window.

signal closed#

Emitted when the window has been closed.

gproperty address: str#
  • read-only

The address of the window.

gproperty mapped: bool#
  • read-only

Whether the window is mapped.

gproperty hidden: bool#
  • read-only

Whether the window is hidden.

gproperty at: tuple[int, int]#
  • read-only

The coordinates of the window (e.g., (1280, 920)).

gproperty size: tuple[int, int]#
  • read-only

The size of the window (e.g., (1280, 920)).

gproperty workspace_id: int#
  • read-only

The ID of the workspace where the window is placed.

gproperty workspace_name: str#
  • read-only

The name of the workspace where the window is placed.

gproperty floating: bool#
  • read-only

Whether the window is floating.

gproperty pseudo: bool#
  • read-only

Whether the window is pseudo.

gproperty monitor: int#
  • read-only

The ID of the monitor where the window is placed.

gproperty class_name: str#
  • read-only

The class name of the window.

gproperty title: str#
  • read-only

The title of the window.

gproperty initial_class: str#
  • read-only

The initial class name of the window.

gproperty initial_title: str#
  • read-only

The initial title of the window.

gproperty pid: int#
  • read-only

The PID of the window.

gproperty xwayland: bool#
  • read-only

Whether the window is running through Xwayland.

gproperty pinned: bool#
  • read-only

Whether the window is pinned.

gproperty fullscreen: int#
  • read-only

The fullscreen mode.

gproperty fullscreen_client: int#
  • read-only

Fullscreen client.

gproperty grouped: list#
  • read-only

Grouped.

gproperty tags: list#
  • read-only

Tags.

gproperty swallowing: str#
  • read-only

Swallowing.

gproperty focus_history_id: int#
  • read-only

The focus history ID.

gproperty inhibiting_idle: bool#
  • read-only

The inhibiting idle status.

class ignis.services.hyprland.HyprlandKeyboard(*args: Any, **kwargs: Any)#

A keyboard.

gproperty address: str#
  • read-only

The address of the keyboard.

gproperty name: str#
  • read-only

The name of the keyboard.

gproperty rules: str#
  • read-only

The rules of the keyboard.

gproperty model: str#
  • read-only

The model of the keyboard.

gproperty layout: str#
  • read-only

The layout of the keyboard.

gproperty variant: str#
  • read-only

The variant of the keyboard.

gproperty options: str#
  • read-only

The options of the keyboard.

gproperty active_keymap: str#
  • read-only

The currently active keymap of the keyboard.

gproperty caps_lock: bool#
  • read-only

Whether Caps Lock is active.

gproperty num_lock: bool#
  • read-only

Whether Num Lock is active.

gproperty main: bool#
  • read-only

Whether the keyboard is main.

switch_layout(layout: str) None#

Switch the keyboard layout.

Parameters:

layout (str) -- The layout to switch to. For example: next, prev, 0, 1, etc.

Return type:

None

class ignis.services.hyprland.HyprlandMonitor(*args: Any, **kwargs: Any)#

A monitor.

signal removed#

Emitted when the monitor has been removed.

gproperty id: int#
  • read-only

The ID of the monitor.

gproperty name: str#
  • read-only

The name of the monitor.

gproperty description: str#
  • read-only

The description of the monitor.

gproperty make: str#
  • read-only

The make of the monitor.

gproperty model: str#
  • read-only

The model of the monitor.

gproperty serial: str#
  • read-only

The serial of the monitor.

gproperty width: int#
  • read-only

The width of the monitor.

gproperty height: int#
  • read-only

The height of the monitor.

gproperty refresh_rate: int#
  • read-only

The refresh rate of the monitor.

gproperty x: int#
  • read-only

The x coordinate of the monitor.

gproperty y: int#
  • read-only

The y coordinate of the monitor.

gproperty active_workspace_id: int#
  • read-only

The ID of the active workspace on this monitor.

gproperty active_workspace_name: str#
  • read-only

The name of the active workspace on this monitor.

gproperty special_workspace_id: int#
  • read-only

The ID of the special workspace on this monitor.

gproperty special_workspace_name: str#
  • read-only

The name of the special workspace on this monitor.

gproperty reserved: tuple[int, int, int, int]#
  • read-only

Reserved.

gproperty scale: float#
  • read-only

The scale of the monitor.

gproperty transform: int#
  • read-only

The transform value (how the monitor is rotated).

gproperty focused: bool#
  • read-only

Whether the monitor is focused.

gproperty dpms_status: bool#
  • read-only

Whether DPMS (Display Power Management Signaling) is on.

gproperty vrr: bool#
  • read-only

Whether VRR (Variable Refresh Rate) is on.

gproperty solitary: str#
  • read-only

The solitary status.

gproperty actively_tearing: bool#
  • read-only

Whether the monitor is actively tearing.

gproperty direct_scanout_to: str#
  • read-only

The direct scanout status.

gproperty disabled: bool#
  • read-only

Whether the monitor is disabled.

gproperty current_format: str#
  • read-only

The current format of the monitor.

gproperty mirror_of: str#
  • read-only

The name of another display that the monitor is mirroring, or "none".

gproperty available_modes: list[str]#
  • read-only

A list of available modes.