summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBossCode45 <human.cyborg42@gmail.com>2024-11-26 15:21:56 +1300
committerBossCode45 <human.cyborg42@gmail.com>2024-11-26 15:21:56 +1300
commit72300460c1c1fa294cc4d1f1026d203a5adf4d28 (patch)
treebabbfba0ca2c9994609238b49e281476660a356d
parent8b48a9cfc4b0795a62a515e2519e7194d1d57347 (diff)
downloadYATwm-72300460c1c1fa294cc4d1f1026d203a5adf4d28.tar.gz
YATwm-72300460c1c1fa294cc4d1f1026d203a5adf4d28.zip
feat: Added a program (YATmsg) to communicate with YATwm
Currently just sends a hello message and nothing else, more to come later
l---------.direnv/flake-profile1
l---------.direnv/flake-profile-1-link1
-rw-r--r--YATmsg/YATmsgbin0 -> 16680 bytes
-rw-r--r--YATmsg/YATmsg.cpp61
-rw-r--r--YATmsg/main.cpp0
-rw-r--r--YATmsg/makefile32
-rw-r--r--compile_commands.json128
-rw-r--r--old.compile_commands.json128
-rw-r--r--src/IPC.cpp16
-rw-r--r--src/IPC.h1
-rw-r--r--src/commands.cpp2
-rw-r--r--src/config.cpp8
-rw-r--r--src/keybinds.cpp2
-rw-r--r--src/main.cpp8
14 files changed, 244 insertions, 144 deletions
diff --git a/.direnv/flake-profile b/.direnv/flake-profile
deleted file mode 120000
index 0c05709..0000000
--- a/.direnv/flake-profile
+++ /dev/null
@@ -1 +0,0 @@
-flake-profile-1-link \ No newline at end of file
diff --git a/.direnv/flake-profile-1-link b/.direnv/flake-profile-1-link
deleted file mode 120000
index 2c4bfed..0000000
--- a/.direnv/flake-profile-1-link
+++ /dev/null
@@ -1 +0,0 @@
-/nix/store/lgavdfyjs3pawq8cpcbrd0idpxkw2xi8-nix-shell-env \ No newline at end of file
diff --git a/YATmsg/YATmsg b/YATmsg/YATmsg
new file mode 100644
index 0000000..ee34c4f
--- /dev/null
+++ b/YATmsg/YATmsg
Binary files differ
diff --git a/YATmsg/YATmsg.cpp b/YATmsg/YATmsg.cpp
new file mode 100644
index 0000000..dbc09b9
--- /dev/null
+++ b/YATmsg/YATmsg.cpp
@@ -0,0 +1,61 @@
+#include <X11/X.h>
+#include <X11/Xlib.h>
+
+#include <iostream>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+
+using std::cout, std::endl;
+
+int main()
+{
+ Display* dpy = XOpenDisplay(nullptr);
+ Window root = Window(DefaultRootWindow(dpy));
+ Atom propName = XInternAtom(dpy, "YATWM_SOCKET_PATH", false);
+ Atom propType = XInternAtom(dpy, "STRING", false);
+ int format;
+ unsigned long length;
+ unsigned long after;
+ Atom type;
+ unsigned char* sockPath;
+
+ if(XGetWindowProperty(dpy, root, propName, 0L, 32L, False, propType, &type, &format, &length, &after, &sockPath) != Success)
+ {
+ cout << "Failed to get path" << endl;
+ XFree(sockPath);
+ return 1;
+ }
+
+ int sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
+ if(sockfd == -1)
+ {
+ cout << "Failed to create socket" << endl;
+ XFree(sockPath);
+ return 1;
+ }
+ sockaddr_un address;
+ address.sun_family = AF_UNIX;
+ strcpy(address.sun_path, (const char*)sockPath);
+ if(connect(sockfd, (sockaddr*) &address, sizeof(address)) == -1)
+ {
+ cout << "Failed connect" << endl;
+ XFree(sockPath);
+ return 1;
+ }
+ const char* command = "echo Hello from YATmsg!!!";
+ if(write(sockfd, command, 22) == -1)
+ {
+ cout << "Failed write" << endl;
+ XFree(sockPath);
+ return 1;
+ }
+
+ char recv[128];
+ read(sockfd, recv, 128);
+ cout << recv << endl;
+
+ close(sockfd);
+ XFree(sockPath);
+ return 0;
+}
diff --git a/YATmsg/main.cpp b/YATmsg/main.cpp
deleted file mode 100644
index e69de29..0000000
--- a/YATmsg/main.cpp
+++ /dev/null
diff --git a/YATmsg/makefile b/YATmsg/makefile
new file mode 100644
index 0000000..6aeee67
--- /dev/null
+++ b/YATmsg/makefile
@@ -0,0 +1,32 @@
+.PHONY: clean
+CXX := g++
+CXXFLAGS := -std=c++17 # -g -fsanitize=address -fno-omit-frame-pointer
+LINKFLAGS := -lX11
+OBJS_DIR := ../build
+OUT_DIR := ../out/
+SOURCE_DIR := ./
+EXEC := YATmsg
+SOURCE_FILES := $(wildcard $(SOURCE_DIR)/*.cpp)
+SOURCE_HEADERS := $(wildcard $(SOURCE_DIR)/*.h)
+OBJS := $(subst $(SOURCE_DIR),$(OBJS_DIR), $(patsubst %.cpp,%.o,$(SOURCE_FILES)))
+INSTALL_DIR = /
+
+$(EXEC): $(OBJS)
+ $(CXX) $(OBJS) $(CXXFLAGS) $(LINKFLAGS) -o $(EXEC)
+
+$(OBJS_DIR)/%.o : $(SOURCE_DIR)/%.cpp
+ $(CXX) $(CXXFLAGS) -c $< -o $@
+
+i: $(EXEC)
+ sudo install -D -m 755 $(EXEC) $(INSTALL_DIR)usr/bin/$(EXEC)
+install: i
+r:
+ sudo rm $(INSTALL_DIR)usr/bin/$(EXEC)
+remove: r
+
+#Files to be compiled
+$(OBJS_DIR)/YATmsg.o: $(SOURCE_FILES) $(SOURCE_HEADERS)
+
+clean:
+ rm $(OBJS_DIR)/*.o
+ rm $(EXEC)
diff --git a/compile_commands.json b/compile_commands.json
new file mode 100644
index 0000000..3a2baf6
--- /dev/null
+++ b/compile_commands.json
@@ -0,0 +1,128 @@
+[
+ {
+ "arguments": [
+ "/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin/g++",
+ "-std=c++17",
+ "-I/nix/store/drrf5w7pcc5q9h4si9i8vm2hclg0zijg-libnotify-0.8.3-dev/include",
+ "-I/nix/store/a45ri2jgzpv6q36va2y6wq471y88hpnl-gdk-pixbuf-2.42.10-dev/include/gdk-pixbuf-2.0",
+ "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include",
+ "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include/glib-2.0",
+ "-I/nix/store/k1qjs35nw1lbssg1l1xpmh0082hy7wl4-glib-2.78.4/lib/glib-2.0/include",
+ "-c",
+ "-o",
+ "build/main.o",
+ "src/main.cpp"
+ ],
+ "directory": "/home/boss/Documents/Coding/WM/YATwm",
+ "file": "/home/boss/Documents/Coding/WM/YATwm/src/main.cpp",
+ "output": "/home/boss/Documents/Coding/WM/YATwm/build/main.o"
+ },
+ {
+ "arguments": [
+ "/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin/g++",
+ "-std=c++17",
+ "-I/nix/store/drrf5w7pcc5q9h4si9i8vm2hclg0zijg-libnotify-0.8.3-dev/include",
+ "-I/nix/store/a45ri2jgzpv6q36va2y6wq471y88hpnl-gdk-pixbuf-2.42.10-dev/include/gdk-pixbuf-2.0",
+ "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include",
+ "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include/glib-2.0",
+ "-I/nix/store/k1qjs35nw1lbssg1l1xpmh0082hy7wl4-glib-2.78.4/lib/glib-2.0/include",
+ "-c",
+ "-o",
+ "build/config.o",
+ "src/config.cpp"
+ ],
+ "directory": "/home/boss/Documents/Coding/WM/YATwm",
+ "file": "/home/boss/Documents/Coding/WM/YATwm/src/config.cpp",
+ "output": "/home/boss/Documents/Coding/WM/YATwm/build/config.o"
+ },
+ {
+ "arguments": [
+ "/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin/g++",
+ "-std=c++17",
+ "-I/nix/store/drrf5w7pcc5q9h4si9i8vm2hclg0zijg-libnotify-0.8.3-dev/include",
+ "-I/nix/store/a45ri2jgzpv6q36va2y6wq471y88hpnl-gdk-pixbuf-2.42.10-dev/include/gdk-pixbuf-2.0",
+ "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include",
+ "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include/glib-2.0",
+ "-I/nix/store/k1qjs35nw1lbssg1l1xpmh0082hy7wl4-glib-2.78.4/lib/glib-2.0/include",
+ "-c",
+ "-o",
+ "build/ewmh.o",
+ "src/ewmh.cpp"
+ ],
+ "directory": "/home/boss/Documents/Coding/WM/YATwm",
+ "file": "/home/boss/Documents/Coding/WM/YATwm/src/ewmh.cpp",
+ "output": "/home/boss/Documents/Coding/WM/YATwm/build/ewmh.o"
+ },
+ {
+ "arguments": [
+ "/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin/g++",
+ "-std=c++17",
+ "-I/nix/store/drrf5w7pcc5q9h4si9i8vm2hclg0zijg-libnotify-0.8.3-dev/include",
+ "-I/nix/store/a45ri2jgzpv6q36va2y6wq471y88hpnl-gdk-pixbuf-2.42.10-dev/include/gdk-pixbuf-2.0",
+ "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include",
+ "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include/glib-2.0",
+ "-I/nix/store/k1qjs35nw1lbssg1l1xpmh0082hy7wl4-glib-2.78.4/lib/glib-2.0/include",
+ "-c",
+ "-o",
+ "build/util.o",
+ "src/util.cpp"
+ ],
+ "directory": "/home/boss/Documents/Coding/WM/YATwm",
+ "file": "/home/boss/Documents/Coding/WM/YATwm/src/util.cpp",
+ "output": "/home/boss/Documents/Coding/WM/YATwm/build/util.o"
+ },
+ {
+ "arguments": [
+ "/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin/g++",
+ "-std=c++17",
+ "-I/nix/store/drrf5w7pcc5q9h4si9i8vm2hclg0zijg-libnotify-0.8.3-dev/include",
+ "-I/nix/store/a45ri2jgzpv6q36va2y6wq471y88hpnl-gdk-pixbuf-2.42.10-dev/include/gdk-pixbuf-2.0",
+ "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include",
+ "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include/glib-2.0",
+ "-I/nix/store/k1qjs35nw1lbssg1l1xpmh0082hy7wl4-glib-2.78.4/lib/glib-2.0/include",
+ "-c",
+ "-o",
+ "build/IPC.o",
+ "src/IPC.cpp"
+ ],
+ "directory": "/home/boss/Documents/Coding/WM/YATwm",
+ "file": "/home/boss/Documents/Coding/WM/YATwm/src/IPC.cpp",
+ "output": "/home/boss/Documents/Coding/WM/YATwm/build/IPC.o"
+ },
+ {
+ "arguments": [
+ "/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin/g++",
+ "-std=c++17",
+ "-I/nix/store/drrf5w7pcc5q9h4si9i8vm2hclg0zijg-libnotify-0.8.3-dev/include",
+ "-I/nix/store/a45ri2jgzpv6q36va2y6wq471y88hpnl-gdk-pixbuf-2.42.10-dev/include/gdk-pixbuf-2.0",
+ "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include",
+ "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include/glib-2.0",
+ "-I/nix/store/k1qjs35nw1lbssg1l1xpmh0082hy7wl4-glib-2.78.4/lib/glib-2.0/include",
+ "-c",
+ "-o",
+ "build/commands.o",
+ "src/commands.cpp"
+ ],
+ "directory": "/home/boss/Documents/Coding/WM/YATwm",
+ "file": "/home/boss/Documents/Coding/WM/YATwm/src/commands.cpp",
+ "output": "/home/boss/Documents/Coding/WM/YATwm/build/commands.o"
+ },
+ {
+ "arguments": [
+ "/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin/g++",
+ "-std=c++17",
+ "-I/nix/store/drrf5w7pcc5q9h4si9i8vm2hclg0zijg-libnotify-0.8.3-dev/include",
+ "-I/nix/store/a45ri2jgzpv6q36va2y6wq471y88hpnl-gdk-pixbuf-2.42.10-dev/include/gdk-pixbuf-2.0",
+ "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include",
+ "-I/nix/store/s0nl17v1827bl7qyjgkkar90c2a40ykb-glib-2.78.4-dev/include/glib-2.0",
+ "-I/nix/store/k1qjs35nw1lbssg1l1xpmh0082hy7wl4-glib-2.78.4/lib/glib-2.0/include",
+ "-c",
+ "-o",
+ "build/keybinds.o",
+ "src/keybinds.cpp"
+ ],
+ "directory": "/home/boss/Documents/Coding/WM/YATwm",
+ "file": "/home/boss/Documents/Coding/WM/YATwm/src/keybinds.cpp",
+ "output": "/home/boss/Documents/Coding/WM/YATwm/build/keybinds.o"
+ }
+]
diff --git a/old.compile_commands.json b/old.compile_commands.json
deleted file mode 100644
index 3997f42..0000000
--- a/old.compile_commands.json
+++ /dev/null
@@ -1,128 +0,0 @@
-[
- {
- "arguments": [
- "/usr/bin/g++",
- "-std=c++17",
- "-I/usr/include/gdk-pixbuf-2.0",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib64/glib-2.0/include",
- "-I/usr/include/sysprof-4",
- "-I/usr/include/libpng16",
- "-I/usr/include/libmount",
- "-I/usr/include/blkid",
- "-pthread",
- "-c",
- "-o",
- "ewmh.o",
- "ewmh.cpp"
- ],
- "directory": "/home/boss/Documents/Coding/WM/YATwm",
- "file": "/home/boss/Documents/Coding/WM/YATwm/ewmh.cpp",
- "output": "/home/boss/Documents/Coding/WM/YATwm/ewmh.o"
- },
- {
- "arguments": [
- "/usr/bin/g++",
- "-std=c++17",
- "-I/usr/include/gdk-pixbuf-2.0",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib64/glib-2.0/include",
- "-I/usr/include/sysprof-4",
- "-I/usr/include/libpng16",
- "-I/usr/include/libmount",
- "-I/usr/include/blkid",
- "-pthread",
- "-c",
- "-o",
- "main.o",
- "main.cpp"
- ],
- "directory": "/home/boss/Documents/Coding/WM/YATwm",
- "file": "/home/boss/Documents/Coding/WM/YATwm/main.cpp",
- "output": "/home/boss/Documents/Coding/WM/YATwm/main.o"
- },
- {
- "arguments": [
- "/usr/bin/g++",
- "-std=c++17",
- "-I/usr/include/gdk-pixbuf-2.0",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib64/glib-2.0/include",
- "-I/usr/include/sysprof-4",
- "-I/usr/include/libpng16",
- "-I/usr/include/libmount",
- "-I/usr/include/blkid",
- "-pthread",
- "-c",
- "-o",
- "util.o",
- "util.cpp"
- ],
- "directory": "/home/boss/Documents/Coding/WM/YATwm",
- "file": "/home/boss/Documents/Coding/WM/YATwm/util.cpp",
- "output": "/home/boss/Documents/Coding/WM/YATwm/util.o"
- },
- {
- "arguments": [
- "/usr/bin/g++",
- "-std=c++17",
- "-I/usr/include/gdk-pixbuf-2.0",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib64/glib-2.0/include",
- "-I/usr/include/sysprof-4",
- "-I/usr/include/libpng16",
- "-I/usr/include/libmount",
- "-I/usr/include/blkid",
- "-pthread",
- "-c",
- "-o",
- "config.o",
- "config.cpp"
- ],
- "directory": "/home/boss/Documents/Coding/WM/YATwm",
- "file": "/home/boss/Documents/Coding/WM/YATwm/config.cpp",
- "output": "/home/boss/Documents/Coding/WM/YATwm/config.o"
- },
- {
- "arguments": [
- "/usr/bin/g++",
- "-std=c++17",
- "-I/usr/include/gdk-pixbuf-2.0",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib64/glib-2.0/include",
- "-I/usr/include/sysprof-4",
- "-I/usr/include/libpng16",
- "-I/usr/include/libmount",
- "-I/usr/include/blkid",
- "-pthread",
- "-c",
- "-o",
- "keybinds.o",
- "keybinds.cpp"
- ],
- "directory": "/home/boss/Documents/Coding/WM/YATwm",
- "file": "/home/boss/Documents/Coding/WM/YATwm/keybinds.cpp",
- "output": "/home/boss/Documents/Coding/WM/YATwm/keybinds.o"
- },
- {
- "arguments": [
- "/usr/bin/g++",
- "-std=c++17",
- "-I/usr/include/gdk-pixbuf-2.0",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib64/glib-2.0/include",
- "-I/usr/include/sysprof-4",
- "-I/usr/include/libpng16",
- "-I/usr/include/libmount",
- "-I/usr/include/blkid",
- "-pthread",
- "-c",
- "-o",
- "commands.o",
- "commands.cpp"
- ],
- "directory": "/home/boss/Documents/Coding/WM/YATwm",
- "file": "/home/boss/Documents/Coding/WM/YATwm/commands.cpp",
- "output": "/home/boss/Documents/Coding/WM/YATwm/commands.o"
- }
-]
diff --git a/src/IPC.cpp b/src/IPC.cpp
index 0aed97e..09bf78e 100644
--- a/src/IPC.cpp
+++ b/src/IPC.cpp
@@ -16,6 +16,10 @@ IPCModule::IPCModule(CommandsModule& commandsModule, Config& cfg, Globals& globa
cfg(cfg),
globals(globals)
{
+}
+
+void IPCModule::init()
+{
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
address.sun_family = AF_UNIX;
strcpy(address.sun_path, path);
@@ -27,15 +31,14 @@ IPCModule::IPCModule(CommandsModule& commandsModule, Config& cfg, Globals& globa
cout << "ERROR " << errno << endl;
}
cout << "SOCKETED" << endl;
-}
-
-void IPCModule::init()
-{
setIPCPath((unsigned char*)path, strlen(path));
+ ready = true;
}
void IPCModule::doListen()
{
+ if(!ready)
+ return;
if(listen(sockfd, 1) != 0)
{
cout << "ERROR 2" << endl;
@@ -75,11 +78,16 @@ void IPCModule::doListen()
void IPCModule::quitIPC()
{
+ if(!ready)
+ return;
close(sockfd);
+ ready = false;
}
int IPCModule::getFD()
{
+ if(!ready)
+ return -1;
if(sockfd > 0)
return sockfd;
return -1;
diff --git a/src/IPC.h b/src/IPC.h
index 89e67e5..97716bb 100644
--- a/src/IPC.h
+++ b/src/IPC.h
@@ -22,5 +22,6 @@ private:
int sockfd;
int len;
bool first = true;
+ bool ready = false;
sockaddr_un address;
};
diff --git a/src/commands.cpp b/src/commands.cpp
index 57cfd0b..5688da4 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -185,7 +185,7 @@ CommandArg* CommandsModule::getCommandArgs(vector<string>& split, const CommandA
rest += " ";
}
args[i-1].str = new char[rest.size()];
- strcpy(args[i-1].str, rest.c_str());
+ strncpy(args[i-1].str, rest.c_str(), rest.size());
return args;
}
case NUM_ARR_REST:
diff --git a/src/config.cpp b/src/config.cpp
index 3af2491..925e6ea 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -4,13 +4,10 @@
#include <X11/Xlib.h>
-#include <cstdio>
-#include <cstring>
#include <fstream>
-#include <ios>
+#include <ostream>
#include <string>
#include <vector>
-#include <sstream>
#include <unistd.h>
#include <fcntl.h>
@@ -94,9 +91,8 @@ std::vector<Err> Config::loadFromFile(std::string path)
//Probably need something for workspaces and binds too...
- string cmd;
int line = 0;
- while(getline(config, cmd))
+ for(string cmd; std::getline(config, cmd);)
{
line++;
if(cmd.size() == 0)
diff --git a/src/keybinds.cpp b/src/keybinds.cpp
index c41452f..235f8c1 100644
--- a/src/keybinds.cpp
+++ b/src/keybinds.cpp
@@ -12,7 +12,7 @@
#include "keybinds.h"
#include "util.h"
-using std::string;
+using std::string, std::cout, std::endl;
bool Keybind::operator<(const Keybind &o) const {
if(key != o.key)
diff --git a/src/main.cpp b/src/main.cpp
index 77f4dbc..a11b203 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1028,11 +1028,11 @@ int main(int argc, char** argv)
return 0;
}
}
+
//Important init stuff
mX = mY = 0;
dpy = XOpenDisplay(nullptr);
root = Window(DefaultRootWindow(dpy));
-
// Adding commands
commandsModule.addCommand("exit", exit, 0, {});
commandsModule.addCommand("spawn", spawn, 1, {STR_REST});
@@ -1051,6 +1051,8 @@ int main(int argc, char** argv)
//Config
std::vector<Err> cfgErr;
+
+ cout << "Registered commands" << endl;
char* confDir = getenv("XDG_CONFIG_HOME");
if(confDir != NULL)
@@ -1063,6 +1065,8 @@ int main(int argc, char** argv)
cfgErr = cfg.loadFromFile(home + "/.config/YATwm/config");
}
+ cout << "Done config" << endl;
+
//Log
yatlog.open(cfg.logFile, std::ios_base::app);
yatlog << "\n" << endl;
@@ -1119,7 +1123,7 @@ int main(int argc, char** argv)
FD_ZERO(&fdset);
FD_SET(x11fd, &fdset);
FD_SET(ipc.getFD(), &fdset);
- int ready = select(x11fd + 1, &fdset, NULL, NULL, NULL);
+ int ready = select(std::max(x11fd, ipc.getFD()) + 1, &fdset, NULL, NULL, NULL);
if(FD_ISSET(ipc.getFD(), &fdset))
{
ipc.doListen();