dwmblocks/include/watcher.h

28 lines
649 B
C
Raw Normal View History

#pragma once
#include <stdbool.h>
#include <sys/poll.h>
2023-10-25 16:30:08 +02:00
#include "block.h"
#include "main.h"
typedef enum {
2023-10-25 16:30:08 +02:00
SIGNAL_FD = BLOCK_COUNT,
WATCHER_FD_COUNT,
} watcher_fd_index;
typedef struct pollfd watcher_fd;
typedef struct {
watcher_fd fds[WATCHER_FD_COUNT];
2023-10-25 16:30:08 +02:00
const block *const blocks;
const unsigned short block_count;
} watcher;
2023-10-25 16:30:08 +02:00
watcher watcher_new(const block *const blocks,
const unsigned short block_count);
int watcher_init(watcher *const watcher, const int signal_fd);
int watcher_poll(watcher *const watcher, const int timeout_ms);
bool watcher_fd_is_readable(const watcher_fd *const watcher_fd);