diff options
| author | BossCode45 <human.cyborg42@gmail.com> | 2024-12-19 15:00:45 +1300 |
|---|---|---|
| committer | BossCode45 <human.cyborg42@gmail.com> | 2024-12-24 15:56:39 +1300 |
| commit | d1d4a63d4473cd4910b678cf5b385f622186fbd3 (patch) | |
| tree | e6a4a478ad63e29ab12479d88a700238b970ec26 /src/IPC.h | |
| parent | c3791254bfb127d64b329098bc792acaa9c30832 (diff) | |
| download | YATwm-d1d4a63d4473cd4910b678cf5b385f622186fbd3.tar.gz YATwm-d1d4a63d4473cd4910b678cf5b385f622186fbd3.zip | |
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.
Diffstat (limited to 'src/IPC.h')
| -rw-r--r-- | src/IPC.h | 25 |
1 files changed, 23 insertions, 2 deletions
@@ -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; +}; |
