Service
exception HyprlandError
Section titled “ HyprlandError ”Bases: Exception
exception HyprlandSocketError
Section titled “ HyprlandSocketError ”Bases: Exception
exception HyprlandSocketNotFoundError
Section titled “ HyprlandSocketNotFoundError ”Bases: Exception
class HyprlandEvent (name: str, data: list[str], raw_data: bytes)
Section titled “ HyprlandEvent ”Bases: object
attribute name str
Section titled “ name ”the name of the received event
attribute data list[str]
Section titled “ data ”the data gotten from event’s body
attribute raw_data bytes
Section titled “ raw_data ”the data as it’s from the socket’s event, it may be formatted as following event-name>>event-data1,event-data2
class HyprlandReply (command: str, reply: bytes, is_ok: bool)
Section titled “ HyprlandReply ”Bases: object
attribute command str
Section titled “ command ”the passed in command
attribute reply bytes
Section titled “ reply ”the raw reply from Hyprland
attribute is_ok bool
Section titled “ is_ok ”this indicates if the ran command has returned ok or not if set to False this means either the command execution has failed or the command itself doesn’t return a indication on if it failed or not (i.e commands that return data from Hyprland)
class Hyprland (commands_only: bool = False, **kwargs)
Section titled “ Hyprland ”Bases: Service
A connection to Hyprland’s socket, can do both sending commands (via a hyprctl-alike interface) and receive events
- Parameters: commands_only (bool , optional) — set to True if you’re going to use this connection for sending commands only, defaults to False
member EVENTS_SOCKET None
Section titled “ EVENTS_SOCKET ”member COMMANDS_SOCKET None
Section titled “ COMMANDS_SOCKET ”member SOCKET_PATH ''
Section titled “ SOCKET_PATH ”property supports_lua bool
Section titled “ supports_lua ”signal ready (self)
Section titled “ ready ”signal event (self, event: object)
Section titled “ event ”static lookup_socket ()tuple[UnixSocketAddress, UnixSocketAddress, str]
Section titled “ lookup_socket ”static send_command (command: str)HyprlandReply
Section titled “ send_command ”Send hyprctl-like commands over hyprland socket
Example usage:
# next workspace...Hyprland.send_command("/dispatch workspace e+1")- Parameters: command (str) — the Hyprland command to send, see Hyprland’s wiki for more info
- Returns: a command reply object contains the reply data from hyprland
- Return type: HyprlandReply
static send_command_async (command: str, callback: ~collections.abc.Callable[[~typing.Concatenate[~fabric.hyprland.service.HyprlandReply, ~P]], ~typing.Any] | None = None, *args: ~typing.~P, **kwargs: ~typing.~P)None
Section titled “ send_command_async ”Same as send_command but this works in an asynchronous manner
- Parameters:
- command (str) — the Hyprland command to send, see Hyprland’s wiki for more info
- callback (Callable [ *[*HyprlandReply ] , Any ]) — the callback on where would you like to receive the reply of the command