Rewrite the entire code-base

The following changes are focused upon:
- Modularity
- Doing away with globals
- No heap allocations
- Better command line interface
- Switch from Xlib to XCB
- More verbose type definitions
- Implement a single-file config by utilising X-macros
This commit is contained in:
Utkarsh Verma
2023-10-24 08:44:31 +05:30
parent 2773129533
commit bc84d094cd
30 changed files with 918 additions and 396 deletions

24
include/block.h Normal file
View File

@@ -0,0 +1,24 @@
#pragma once
#include <bits/stdint-uintn.h>
#include <stdbool.h>
#include <sys/types.h>
#include "config.h"
#include "util.h"
typedef struct {
const char *const command;
const unsigned int interval;
const int signal;
int pipe[PIPE_FD_COUNT];
char output[MAX_BLOCK_OUTPUT_LENGTH * UTF8_MAX_BYTE_COUNT + 1];
pid_t fork_pid;
} block;
int block_init(block *const block);
int block_deinit(block *const block);
int block_execute(block *const block, const uint8_t button);
int block_update(block *const block);
bool block_must_run(const block *const block, const unsigned int time);