Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions i3ipc/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
11 changes: 11 additions & 0 deletions i3ipc/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -248,6 +251,14 @@ class OutputReply(_ReplyType):
pass


class InputReply(_ReplyType):
pass


class SeatReply(_ReplyType):
pass


class WorkspaceReply(_ReplyType):
pass

Expand Down