docs/ipc: document i3 --get-socketpath

This commit is contained in:
Michael Stapelberg 2011-10-20 19:46:57 +01:00
parent c5caa9682c
commit a33c720ce8

View File

@ -1,7 +1,7 @@
IPC interface (interprocess communication) IPC interface (interprocess communication)
========================================== ==========================================
Michael Stapelberg <michael+i3@stapelberg.de> Michael Stapelberg <michael+i3@stapelberg.de>
March 2010 October 2011
This document describes how to interface with i3 from a separate process. This This document describes how to interface with i3 from a separate process. This
is useful for example to remote-control i3 (to write test cases for example) or is useful for example to remote-control i3 (to write test cases for example) or
@ -12,7 +12,7 @@ The method of choice for IPC in our case is a unix socket because it has very
little overhead on both sides and is usually available without headaches in little overhead on both sides and is usually available without headaches in
most languages. In the default configuration file, the ipc-socket gets created most languages. In the default configuration file, the ipc-socket gets created
in +/tmp/i3-%u/ipc-socket.%p+ where +%u+ is your UNIX username and +%p+ is the in +/tmp/i3-%u/ipc-socket.%p+ where +%u+ is your UNIX username and +%p+ is the
PID of i3. PID of i3. You can get the socketpath from i3 by calling +i3 --get-socketpath+.
All i3 utilities, like +i3-msg+ and +i3-input+ will read the +I3_SOCKET_PATH+ All i3 utilities, like +i3-msg+ and +i3-input+ will read the +I3_SOCKET_PATH+
X11 property, stored on the X11 root window. X11 property, stored on the X11 root window.
@ -24,7 +24,8 @@ snippet illustrates this in Perl:
------------------------------------------------------------- -------------------------------------------------------------
use IO::Socket::UNIX; use IO::Socket::UNIX;
my $sock = IO::Socket::UNIX->new(Peer => '/tmp/i3-ipc.sock'); chomp(my $path = qx(i3 --get-socketpath));
my $sock = IO::Socket::UNIX->new(Peer => $path);
------------------------------------------------------------- -------------------------------------------------------------
== Sending messages to i3 == Sending messages to i3