summaryrefslogtreecommitdiff
path: root/dwmblocks/include/watcher.h
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-03-08 15:21:28 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-03-08 15:21:28 +0900
commit4437d5b3c3eea76f6e2b0fd4a2ba21c02a098aeb (patch)
treee8dcb20bf144aacf88f93b012dccacdeb08015cd /dwmblocks/include/watcher.h
parentc2b06f0d5795a789f4ddab459179ff89aedfee98 (diff)
updates
Diffstat (limited to 'dwmblocks/include/watcher.h')
-rw-r--r--dwmblocks/include/watcher.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/dwmblocks/include/watcher.h b/dwmblocks/include/watcher.h
new file mode 100644
index 0000000..ff31809
--- /dev/null
+++ b/dwmblocks/include/watcher.h
@@ -0,0 +1,28 @@
+#ifndef WATCHER_H
+#define WATCHER_H
+
+#include <poll.h>
+#include <stdbool.h>
+
+#include "block.h"
+#include "main.h"
+
+enum watcher_fd_index {
+ SIGNAL_FD = BLOCK_COUNT,
+ WATCHER_FD_COUNT,
+};
+
+typedef struct pollfd watcher_fd;
+
+typedef struct {
+ watcher_fd fds[WATCHER_FD_COUNT];
+ unsigned short active_blocks[BLOCK_COUNT];
+ unsigned short active_block_count;
+ bool got_signal;
+} watcher;
+
+int watcher_init(watcher *const watcher, const block *const blocks,
+ const unsigned short block_count, const int signal_fd);
+int watcher_poll(watcher *const watcher, const int timeout_ms);
+
+#endif // WATCHER_H