From d1d4a63d4473cd4910b678cf5b385f622186fbd3 Mon Sep 17 00:00:00 2001 From: BossCode45 Date: Thu, 19 Dec 2024 15:00:45 +1300 Subject: feat: Added IPC client side to main binary Updated command line arguments to use `getopt_long' Made it so both -v and --version work Made it so that if you give it non recognised arguments they are sent through the socket to the running window manager if possible. --- src/IPC.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src/IPC.h') diff --git a/src/IPC.h b/src/IPC.h index 97716bb..e0bbcee 100644 --- a/src/IPC.h +++ b/src/IPC.h @@ -7,10 +7,10 @@ #include "config.h" #include "util.h" -class IPCModule +class IPCServerModule { public: - IPCModule(CommandsModule& commandsModule, Config& cfg, Globals& globals); + IPCServerModule(CommandsModule& commandsModule, Config& cfg, Globals& globals); void init(); void doListen(); void quitIPC(); @@ -25,3 +25,24 @@ private: bool ready = false; sockaddr_un address; }; + +class IPCClientModule +{ +public: + IPCClientModule(); + + // Returns 0 for success, 1 for X error, -1 for socket error + int init(); + + // Returns 0 for success, 1 for not ready, -1 for socket error + int sendMessage(const char* message, int length); + + // Returns 0 for success, 1 for not ready, -1 for socket error + int getMessage(char* buff, int buffsize); + + + void quit(); +private: + bool ready; + int sockfd; +}; -- cgit v1.2.3