diff --git a/i3ipc/connection.py b/i3ipc/connection.py index 4fffba0..edfb2ac 100644 --- a/i3ipc/connection.py +++ b/i3ipc/connection.py @@ -2,8 +2,8 @@ from .con import Con from .model import (Event, MessageType, CommandReply, VersionReply, BarConfigReply, OutputReply, - WorkspaceReply, ConfigReply, TickEvent, TickReply, WorkspaceEvent, GenericEvent, - WindowEvent, BarconfigUpdateEvent, BindingEvent) + InputReply, SeatReply, WorkspaceReply, ConfigReply, TickEvent, TickReply, + WorkspaceEvent, GenericEvent, WindowEvent, BarconfigUpdateEvent, BindingEvent) from ._private import PubSub, PropsObject import sys @@ -272,6 +272,28 @@ def get_outputs(self): data = self.message(MessageType.GET_OUTPUTS, '') return json.loads(data, object_hook=OutputReply) + def get_inputs(self): + """ + Get a list of sway inputs. The equivalent of + :command:`swaymsg -t get_inputs`. + + :rtype: List of :class:`InputReply`. + + """ + data = self.message(MessageType.GET_INPUTS, '') + return json.loads(data, object_hook=InputReply) + + def get_seats(self): + """ + Get a list of sway seats. The equivalent of + :command:`swaymsg -t get_seats`. + + :rtype: List of :class:`SeatReply`. + + """ + data = self.message(MessageType.GET_SEATS, '') + return json.loads(data, object_hook=SeatReply) + def get_workspaces(self): """ Get a list of workspaces. Returns JSON-like data, not a Con instance. diff --git a/i3ipc/model.py b/i3ipc/model.py index d5bf127..d35d8b8 100644 --- a/i3ipc/model.py +++ b/i3ipc/model.py @@ -15,6 +15,9 @@ class MessageType(Enum): GET_BINDING_MODES = 8 GET_CONFIG = 9 SEND_TICK = 10 + # sway-specific command types + GET_INPUTS = 100 + GET_SEATS = 101 class ReplyType(Enum): @@ -248,6 +251,14 @@ class OutputReply(_ReplyType): pass +class InputReply(_ReplyType): + pass + + +class SeatReply(_ReplyType): + pass + + class WorkspaceReply(_ReplyType): pass