-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.h
82 lines (70 loc) · 1.38 KB
/
config.h
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef _CONFIGH_
#define _CONFIGH_
#include <stdbool.h>
#include <stdio.h>
#include "keys.h"
#include "util.h"
// should be ansi escape codes under \x1b[...m
// if not prepared accordingly, it might break
struct theme_colors {
char *bg;
char *fg;
char *err;
char *s_wayland;
char *s_xorg;
char *s_shell;
char *e_hostname;
char *e_date;
char *e_box;
char *e_header;
char *e_user;
char *e_passwd;
char *e_badpasswd;
char *e_key;
};
// even if they're multiple bytes long
// they should only take up 1 char size on display
struct theme_chars {
char *hb;
char *vb;
char *ctl;
char *ctr;
char *cbl;
char *cbr;
};
struct theme {
struct theme_colors colors;
struct theme_chars chars;
};
struct functions {
enum keys poweroff;
enum keys reboot;
enum keys refresh;
};
struct strings {
char *f_poweroff;
char *f_reboot;
char *f_refresh;
char *e_user;
char *e_passwd;
char *s_wayland;
char *s_xorg;
char *s_shell;
};
struct behavior {
bool include_defshell;
struct Vector source;
struct Vector user_source;
};
struct config {
struct theme theme;
struct functions functions;
struct strings strings;
struct behavior behavior;
};
bool line_parser(
FILE *fd, ssize_t *blksize,
u_char (*cb)(char *key,
char *value)); // might use this for parsing .desktop files too
struct config *parse_config(char *path);
#endif