Re: [i3] IPC interface - reply format change for command message type

  • From: Michael Stapelberg <michael@xxxxxxxx>
  • To: Discussions/Questions about the i3 window manager <i3-discuss@xxxxxxxxxxxxx>
  • Date: Fri, 27 Apr 2012 16:10:18 +0200

Hey Jure,

Quoting Jure Žiberna (2012-04-27 15:42:17)

I've noticed that the reply format for command messages has changed in 4.2-1.
It now returns a list with a dictionary as its only element instead of just a
dictionary and empty list for non-existent commands instead of a dictionary
with error message under 'error' key. I've tested this with i3-msg and also
with sockets in Python (i3-py).
For non-existent commands, we should communicate an error. This was an
oversight and will be corrected. Please open a ticket for that.

Was this intentional or is it going to change back to how it was before? (I
can't find the commit where this was changed.) In my opinion the previous
reply
format was more valuable.
The new command reply format is intentional and will not change back. Please
note that before 4.2, commands officially had no reply (the documentation was
changed in commit 1f0c0cdd). The reply change was done in commit e114b3dba. The
reason for an array of return values is that you can chain commands like "focus
left; focus down". You are actually running two commands and therefore deserve
to get two return values. To keep things simple, we don’t just return one JSON
object if you run a single command and an JSON array if you run multiple.
Instead, we just always return an JSON array with >= 1 entries.

Best regards,
Michael

Other related posts:

  • » Re: [i3] IPC interface - reply format change for command message type - Michael Stapelberg