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
most languages. In the default configuration file, no ipc-socket path is
-specified and thus no socket is created. The standard path (which +i3-msg+ and
-+i3-input+ use) is +/tmp/i3-ipc.sock+.
+specified and thus no socket is created. Alternatively you can set the
+environment-variable +I3SOCK+. Setting a path in the configfile will override
++I3SOCK+.
+
++i3-msg+ and +i3-input+ will use +I3SOCK+ to connect to i3, unless -s is passed.
+If neither is given, they will default to +/tmp/i3-ipc.sock+.
== Establishing a connection
To enable it, you have to configure a path where the unix socket will be
stored. The default path is +/tmp/i3-ipc.sock+.
+You can override the default path through the environment-variable +I3SOCK+.
+
*Examples*:
----------------------------
ipc-socket /tmp/i3-ipc.sock
}
int main(int argc, char *argv[]) {
- char *socket_path = "/tmp/i3-ipc.sock";
+ char *socket_path;
+ if ((socket_path = getenv("I3SOCK")) == NULL) {
+ socket_path = "/tmp/i3-ipc.sock";
+ }
char *pattern = "-misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
int o, option_index = 0;
}
int main(int argc, char *argv[]) {
- char *socket_path = "/tmp/i3-ipc.sock";
+ char *socket_path;
+ if ((socket_path = getenv("I3SOCK")) == NULL) {
+ socket_path = "/tmp/i3-ipc.sock";
+ }
int o, option_index = 0;
int message_type = I3_IPC_MESSAGE_TYPE_COMMAND;
char *payload = "";
i3-input -p 'mark ' -l 1 -P 'Mark: '
------------------------------------------------
+== ENVIRONMENT
+
+=== I3SOCK
+
+If no ipc-socket is specified on the commandline, this variable is used
+to determine the path, at wich the unix domain socket is expected, on which
+to connect to i3.
+
== SEE ALSO
i3(1)
i3-msg "bp" # Use 1-px border for current client
------------------------------------------------
+== ENVIRONMENT
+
+=== I3SOCK
+
+If no ipc-socket is specified on the commandline, this variable is used
+to determine the path, at wich the unix domain socket is expected, on which
+to connect to i3.
+
== SEE ALSO
i3(1)
exec /usr/bin/i3 >> ~/.i3/logfile
-------------------------------------------------------------
+== ENVIRONMENT
+
+=== I3SOCK
+
+If no ipc-socket is specified in the configfile, this variable is used
+to determine the path, at wich the unix domain socket is created, on which
+i3 listenes to incoming connections.
+
== TODO
There is still lot of work to do. Please check our bugtracker for up-to-date
if (!isatty(fileno(stdout)))
setbuf(stdout, NULL);
+ config.ipc_socket_path = getenv("I3SOCK");
+
start_argv = argv;
while ((opt = getopt_long(argc, argv, "c:CvaL:hld:V", long_options, &option_index)) != -1) {