From e7bf93163d2356393e3b969d9f6e77631bd9179d Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 28 Jul 2009 22:09:53 +0200 Subject: [PATCH] Make path configurable --- Makefile | 2 +- include/config.h | 2 ++ src/config.c | 5 +++++ src/mainx.c | 16 +++++++++------- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 8666d9ef..850693e3 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ install: all $(INSTALL) -m 0755 i3 $(DESTDIR)/usr/bin/ test -e $(DESTDIR)/etc/i3/config || $(INSTALL) -m 0644 i3.config $(DESTDIR)/etc/i3/config $(INSTALL) -m 0644 i3.desktop $(DESTDIR)/usr/share/xsessions/ - $(MAKE) TOPDIR=$(TOPDIR) -C i3-msg + $(MAKE) TOPDIR=$(TOPDIR) -C i3-msg install dist: clean [ ! -d i3-${VERSION} ] || rm -rf i3-${VERSION} diff --git a/include/config.h b/include/config.h index 80fa2f02..cfedfdb8 100644 --- a/include/config.h +++ b/include/config.h @@ -53,6 +53,8 @@ struct Config { const char *terminal; const char *font; + const char *ipc_socket_path; + /** The modifier which needs to be pressed in combination with your mouse * buttons to do things with floating windows (move, resize) */ uint32_t floating_modifier; diff --git a/src/config.c b/src/config.c index fc5fa647..2f78dec9 100644 --- a/src/config.c +++ b/src/config.c @@ -408,6 +408,11 @@ void load_configuration(xcb_connection_t *conn, const char *override_configpath, continue; } + if (strcasecmp(key, "ipc-socket") == 0) { + config.ipc_socket_path = sstrdup(value); + continue; + } + die("Unknown configfile option: %s\n", key); } /* now grab all keys again */ diff --git a/src/mainx.c b/src/mainx.c index 684526c6..03cb9d1b 100644 --- a/src/mainx.c +++ b/src/mainx.c @@ -370,13 +370,15 @@ int main(int argc, char *argv[], char *env[]) { } /* Create the UNIX domain socket for IPC */ - int ipc_socket = ipc_create_socket("/tmp/i3.s"); - if (ipc_socket == -1) { - LOG("Could not create the IPC socket, IPC disabled\n"); - } else { - struct ev_io *ipc_io = scalloc(sizeof(struct ev_io)); - ev_io_init(ipc_io, ipc_new_client, ipc_socket, EV_READ); - ev_io_start(loop, ipc_io); + if (config.ipc_socket_path != NULL) { + int ipc_socket = ipc_create_socket(config.ipc_socket_path); + if (ipc_socket == -1) { + LOG("Could not create the IPC socket, IPC disabled\n"); + } else { + struct ev_io *ipc_io = scalloc(sizeof(struct ev_io)); + ev_io_init(ipc_io, ipc_new_client, ipc_socket, EV_READ); + ev_io_start(loop, ipc_io); + } } /* Handle the events which arrived until now */