blob: 31005e7bacb1c7fe5501052be5f903f877fc8548 (
plain) (
blame)
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
83
84
85
86
87
88
89
90
91
92
93
|
#pragma once
#include "error.h"
#include <toml++/toml.hpp>
#include <X11/X.h>
#include <X11/keysym.h>
#include <string>
enum MoveDir
{
Up,
Right,
Down,
Left
};
typedef union
{
char* str;
int num;
MoveDir dir;
} KeyArg;
struct KeyBind
{
unsigned int modifiers;
KeySym keysym;
void(* func) (const KeyArg arg);
KeyArg args;
};
//Keybind commands
#define KEYCOM(X) \
void X (const KeyArg arg)
KEYCOM(exit);
KEYCOM(spawn);
KEYCOM(toggle);
KEYCOM(kill);
KEYCOM(changeWS);
KEYCOM(wToWS);
KEYCOM(focChange);
KEYCOM(wMove);
KEYCOM(bashSpawn);
KEYCOM(reload);
KEYCOM(wsDump);
KEYCOM(nextMonitor);
class Config
{
public:
Config();
~Config();
void free();
Err loadFromFile(std::string path);
Err reload();
// Startup
std::string* startupBash;
int startupBashc;
// Main
int gaps;
int outerGaps;
std::string logFile;
// Workspaces
int numWS;
std::string* workspaceNames;
int workspaceNamesc;
int maxMonitors;
int** screenPreferences;
int screenPreferencesc;
// Keybinds
KeyBind* binds;
int bindsc;
private:
template <typename T>
T getValue(std::string path, Err* err);
void loadWorkspaceArrays(toml::table tbl, toml::table defaults, Err* err);
void loadStartupBash(toml::table tbl, toml::table defaults, Err* err);
toml::table tbl;
toml::table defaults;
bool loaded = false;
std::string path;
};
|