aboutsummaryrefslogtreecommitdiff
path: root/src/config.h
blob: 45800318e64529551660e4c7ffaf8b7d9c49fba0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef COMET_CONFIG_H
#define COMET_CONFIG_H

#include <stdio.h>
#include <stdint.h>

#include "util.h"

typedef struct block block_t;

typedef struct effect effect_t;

typedef enum {
    CONFIG_STRING,
    CONFIG_INT,
    CONFIG_UINT,
    CONFIG_DOUBLE,
    CONFIG_BOOL,
    CONFIG_COLOR,
    CONFIG_ENUM,
    CONFIG_TIME,
    CONFIG_LIST,
} config_type_t;

typedef struct {
    const char *key;
    config_type_t type;
    void *data;
    size_t offset;
} config_entry_t;

typedef struct {
    size_t n_blocks;
    block_t *blocks;
    size_t n_effects;
    effect_t *effects;
    char *font;
    char *monitor;
    bool override_redirect;
    color_t background;
    unsigned int width;
    unsigned int height;
} config_t;

typedef struct {
    const char *label;
    intptr_t value;
} config_enum_t;

void config_init(config_t *config);

void config_read(config_t *config, FILE *file);

block_t *config_resolve(config_t *config);

void config_free(config_t *config);

#endif