Use I3SOCK-environment-variable

This commit is contained in:
Axel Wagner 2011-01-11 04:39:48 +01:00 committed by Michael Stapelberg
parent cd2ee61ee8
commit 4caf85aa0b
8 changed files with 42 additions and 4 deletions

View File

@ -11,8 +11,12 @@ workspace bar.
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

View File

@ -521,6 +521,8 @@ programs to get information from i3, such as the current workspaces
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

View File

@ -241,7 +241,10 @@ static int handle_key_press(void *ignored, xcb_connection_t *conn, xcb_key_press
}
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;

View File

@ -107,7 +107,10 @@ static void ipc_recv_message(int sockfd, uint32_t message_type,
}
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 = "";

View File

@ -23,6 +23,14 @@ mark/goto command.
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)

View File

@ -24,6 +24,14 @@ future (staying backwards-compatible, of course).
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)

View File

@ -282,6 +282,14 @@ echo "Starting at $(date)" >> ~/.i3/logfile
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

View File

@ -99,6 +99,8 @@ int main(int argc, char *argv[]) {
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) {