@@ -185,7 +185,8 @@ def command(self, payload):
185185 """
186186 data = self ._message (MessageType .COMMAND , payload )
187187 if data :
188- return json .loads (data , object_hook = CommandReply )
188+ data = json .loads (data )
189+ return [CommandReply (d ) for d in data ]
189190 else :
190191 return []
191192
@@ -196,7 +197,8 @@ def get_version(self):
196197 :rtype: :class:`i3ipc.VersionReply`
197198 """
198199 data = self ._message (MessageType .GET_VERSION , '' )
199- return json .loads (data , object_hook = VersionReply )
200+ data = json .loads (data )
201+ return VersionReply (data )
200202
201203 def get_bar_config (self , bar_id = None ):
202204 """Gets the bar configuration specified by the id.
@@ -216,7 +218,8 @@ def get_bar_config(self, bar_id=None):
216218 bar_id = bar_config_list [0 ]
217219
218220 data = self ._message (MessageType .GET_BAR_CONFIG , bar_id )
219- return json .loads (data , object_hook = BarConfigReply )
221+ data = json .loads (data )
222+ return BarConfigReply (data )
220223
221224 def get_bar_config_list (self ):
222225 """Gets the names of all bar configurations.
@@ -234,7 +237,8 @@ def get_outputs(self):
234237 :rtype: list(:class:`i3ipc.OutputReply`)
235238 """
236239 data = self ._message (MessageType .GET_OUTPUTS , '' )
237- return json .loads (data , object_hook = OutputReply )
240+ data = json .loads (data )
241+ return [OutputReply (d ) for d in data ]
238242
239243 def get_inputs (self ):
240244 """(sway only) Gets the inputs connected to the compositor.
@@ -243,7 +247,8 @@ def get_inputs(self):
243247 :rtype: :class:`i3ipc.InputReply`
244248 """
245249 data = self ._message (MessageType .GET_INPUTS , '' )
246- return json .loads (data , object_hook = InputReply )
250+ data = json .loads (data )
251+ return [InputReply (d ) for d in data ]
247252
248253 def get_seats (self ):
249254 """(sway only) Gets the seats configured on the compositor
@@ -252,7 +257,8 @@ def get_seats(self):
252257 :rtype: :class:`i3ipc.SeatReply`
253258 """
254259 data = self ._message (MessageType .GET_SEATS , '' )
255- return json .loads (data , object_hook = SeatReply )
260+ data = json .loads (data )
261+ return [SeatReply (d ) for d in data ]
256262
257263 def get_workspaces (self ):
258264 """Gets the list of current workspaces.
@@ -261,7 +267,8 @@ def get_workspaces(self):
261267 :rtype: list(:class:`i3ipc.WorkspaceReply`)
262268 """
263269 data = self ._message (MessageType .GET_WORKSPACES , '' )
264- return json .loads (data , object_hook = WorkspaceReply )
270+ data = json .loads (data )
271+ return [WorkspaceReply (ws ) for ws in data ]
265272
266273 def get_tree (self ):
267274 """Gets the root container of the i3 layout tree.
@@ -297,7 +304,8 @@ def get_config(self):
297304 :rtype: :class:`i3ipc.ConfigReply`
298305 """
299306 data = self ._message (MessageType .GET_CONFIG , '' )
300- return json .loads (data , object_hook = ConfigReply )
307+ data = json .loads (data )
308+ return ConfigReply (data )
301309
302310 def send_tick (self , payload = "" ):
303311 """Sends a tick with the specified payload.
@@ -306,7 +314,8 @@ def send_tick(self, payload=""):
306314 :rtype: :class:`i3ipc.TickReply`
307315 """
308316 data = self ._message (MessageType .SEND_TICK , payload )
309- return json .loads (data , object_hook = TickReply )
317+ data = json .loads (data )
318+ return TickReply (data )
310319
311320 def _subscribe (self , events ):
312321 events_obj = []
@@ -332,7 +341,8 @@ def _subscribe(self, events):
332341 data = self ._ipc_send (self ._sub_socket , MessageType .SUBSCRIBE , json .dumps (events_obj ))
333342 finally :
334343 self ._sub_lock .release ()
335- result = json .loads (data , object_hook = CommandReply )
344+ data = json .loads (data )
345+ result = CommandReply (data )
336346 self .subscriptions |= events
337347 return result
338348
0 commit comments