Hyprland#
- class ignis.services.hyprland.HyprlandService(*args: Any, **kwargs: Any)#
Hyprland IPC client.
- Properties:
workspaces (
list[dict[str, Any]]
, read-only): A list of workspaces.active_workspace (
Dict[str, Any]
, read-only): The currently active workspace.kb_layout (
str
, read-only): The currenly active keyboard layout.active_window (
Dict[str, Any]
, read-only): The currenly focused window.
- Raises:
HyprlandIPCNotFoundError -- If Hyprland IPC is not found.
Note
The contents of "dictionary" (
Dict
) properties are not described here. To find out their contents just print them into the terminal.>>> print(hyprland.workspaces) [ { "id": 1, "name": "1", "monitor": "DP-1", "monitorID": 1, "windows": 1, "hasfullscreen": False, "lastwindow": "0x561dc35d2e80", "lastwindowtitle": "hyprland.py - ignis - Visual Studio Code", }, { "id": 10, "name": "10", "monitor": "HDMI-A-1", "monitorID": 0, "windows": 1, "hasfullscreen": False, "lastwindow": "0x561dc3845f30", "lastwindowtitle": "Type hints cheat sheet - mypy 1.11.2 documentation — Mozilla Firefox", }, ]
>>> print(hyprland.active_window) { "address": "0x561dc35d2e80", "mapped": True, "hidden": False, "at": [1942, 22], "size": [1876, 1036], "workspace": {"id": 1, "name": "1"}, "floating": False, "pseudo": False, "monitor": 1, "class": "code-url-handler", "title": "hyprland.py - ignis - Visual Studio Code", "initialClass": "code-url-handler", "initialTitle": "Visual Studio Code", "pid": 1674, "xwayland": False, "pinned": False, "fullscreen": 0, "fullscreenClient": 0, "grouped": [], "tags": [], "swallowing": "0x0", "focusHistoryID": 0, }
Example usage:
from ignis.service import HyprlandService hyprland = HyprlandService.get_default() print(hyprland.workspaces) print(hyprland.kb_layout) hyprland.connect("notify::kb-layout", lambda x, y: print(hyprland.kb_layout))
- send_command(cmd: str) str #
Send command to Hyprland IPC. Supported the same commands as in hyprctl. If you want to get response as JSON use this syntax:
j/COMMAND
.- Parameters:
cmd (
str
) -- A command.- Returns:
Response from Hyprland IPC.
- switch_kb_layout() None #
Just switch to next keyboard layout.
- switch_to_workspace(workspace_id: int) None #
Switch to workspace by ID.
- Parameters:
workspace_id (
int
) -- ID of workspace to be switched to