Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Add a section on the sync IPC command
Browse files Browse the repository at this point in the history
Signed-off-by: Uli Schlachter <psychon@znc.in>
  • Loading branch information
psychon authored and stapelberg committed Mar 12, 2021
1 parent 8a5eac3 commit fd500ee
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion docs/testsuite
Expand Up @@ -569,7 +569,35 @@ i3 will then reply with the same ClientMessage, sent to the window specified in
request. You should use a random value in +data[1]+ and check that you received
the same one when getting the reply.

== Appendix B: Socket activation
== Appendix B: The sync IPC command

The above I3_SYNC protocol allows to synchronise with i3. However, it is not
enough for tests that also involve i3bar: There might still be messages from
i3bar in-flight even after synchronising with i3. Thus, there also exists a sync
IPC command, that is however not meant to be used directly. Instead, i3bar uses
it for implementing the I3_SYNC protocol.

The intended usage works like this:

1. You send an I3_SYNC message to i3bar's window. See <<i3_sync>>.
2. i3bar sends a SYNC IPC command to i3 with payload
+{"window":your-window-here,"rnd":your-random-value}+.
3. i3 reacts to this IPC command as if it received an I3_SYNC request via X11.

This protocol is used, for example, in t/525-i3bar-mouse-bindings.t: A mouse
button press on i3bar is triggered. i3bar reacts to this by sending IPC commands
to i3.

The necessary synchronisation is achieved by sending an I3_SYNC event to i3bar:
Because i3bar reacts with a sync IPC command to i3, all previous IPC commands from
i3bar will be handled first. Because i3 reacts via X11, all previous X11
requests from i3 will be handled by the X11 server first.

The actual test also has to sync with i3 first due to how X11 handling works. If
you really want to know more, I am sorry for you and recommend to read up on
XAllowEvents with mode ReplayPointer.

== Appendix C: Socket activation

Socket activation is a mechanism which was made popular by systemd, an init
replacement. It basically describes creating a listening socket before starting
Expand Down

0 comments on commit fd500ee

Please sign in to comment.