Service
exception I3Error
Section titled “ I3Error ”Bases: Exception
exception I3SocketError
Section titled “ I3SocketError ”Bases: I3Error
exception I3SocketNotFoundError
Section titled “ I3SocketNotFoundError ”Bases: I3SocketError
class I3MessageType (value, names=_not_given, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Section titled “ I3MessageType ”Bases: IntEnum
member COMMAND 0
Section titled “ COMMAND ”member GET_WORKSPACES 1
Section titled “ GET_WORKSPACES ”member SUBSCRIBE 2
Section titled “ SUBSCRIBE ”member GET_OUTPUTS 3
Section titled “ GET_OUTPUTS ”member GET_TREE 4
Section titled “ GET_TREE ”member GET_MARKS 5
Section titled “ GET_MARKS ”member GET_BAR_CONFIG 6
Section titled “ GET_BAR_CONFIG ”member GET_VERSION 7
Section titled “ GET_VERSION ”member GET_BINDING_MODES 8
Section titled “ GET_BINDING_MODES ”member GET_CONFIG 9
Section titled “ GET_CONFIG ”member SEND_TICK 10
Section titled “ SEND_TICK ”member SYNC 11
Section titled “ SYNC ”member GET_BINDING_STATE 12
Section titled “ GET_BINDING_STATE ”member GET_INPUTS 100
Section titled “ GET_INPUTS ”member GET_SEATS 101
Section titled “ GET_SEATS ”member WORKSPACE_EVENT 2147483648
Section titled “ WORKSPACE_EVENT ”member OUTPUT_EVENT 2147483649
Section titled “ OUTPUT_EVENT ”member MODE_EVENT 2147483650
Section titled “ MODE_EVENT ”member WINDOW_EVENT 2147483651
Section titled “ WINDOW_EVENT ”member BARCONFIG_UPDATE_EVENT 2147483652
Section titled “ BARCONFIG_UPDATE_EVENT ”member BINDING_EVENT 2147483653
Section titled “ BINDING_EVENT ”member SHUTDOWN_EVENT 2147483654
Section titled “ SHUTDOWN_EVENT ”member TICK_EVENT 2147483655
Section titled “ TICK_EVENT ”member BAR_STATE_UPDATE_EVENT 2147483668
Section titled “ BAR_STATE_UPDATE_EVENT ”member INPUT_EVENT 2147483669
Section titled “ INPUT_EVENT ”class I3Event (name: str, data: dict, raw_data: bytes)
Section titled “ I3Event ”Bases: object
attribute name str
Section titled “ name ”the name of the received event
attribute data dict
Section titled “ data ”the json data gotten from event’s body
attribute raw_data bytes
Section titled “ raw_data ”the raw json data
class I3Reply (command: str, reply: dict | list, is_ok: bool)
Section titled “ I3Reply ”Bases: object
attribute command str
Section titled “ command ”the passed in command
attribute reply dict | list
Section titled “ reply ”the raw reply from i3/sway as a dict or list
attribute is_ok bool
Section titled “ is_ok ”this indicates if the ran command has returned a success message
class I3 (**kwargs)
Section titled “ I3 ”Bases: Service
A connection to the i3/Sway’s IPC socket. This can be used for sending commands and receiving events.
Default service constructor (base constructor)
-
Parameters: **kwargs —
mapped to signal connections (e.g. on_clicked=lambda *_: … connects the given function to the signal “clicked”, notify_my_property=my_func connects the given function to the signal “notify::my-property”)
attribute SOCKET_PATH str | None
Section titled “ SOCKET_PATH ”property ready bool
Section titled “ ready ”signal event (self, event: object)
Section titled “ event ”static lookup_socket ()str
Section titled “ lookup_socket ”static pack bytes
Section titled “ pack ”static unpack (connection: socket)tuple[int, str]
Section titled “ unpack ”static send_command I3Reply
Section titled “ send_command ”Sends a command to the i3/sway socket.
example usage: “python
next workspace…
Section titled “next workspace…”I3.send_command(“workspace next”) “ :param command: The command to send. :type command: str :param message_type: The type of message to send. :type message_type: I3MessageType, optional :return: A reply object containing the data from i3/sway. :rtype: I3Reply