diff options
| author | BossCode45 <human.cyborg42@gmail.com> | 2023-02-01 20:07:40 +1300 |
|---|---|---|
| committer | BossCode45 <human.cyborg42@gmail.com> | 2023-02-01 20:07:40 +1300 |
| commit | 4b2507efc3721fbeb8282e1831273d0a9c445ae6 (patch) | |
| tree | 6ab48529bb69ac460bd47f55839f215a6aa3cd8c /config.h | |
| parent | 585af104691e91ad12adced578eabe8cfbfba9b8 (diff) | |
| download | YATwm-4b2507efc3721fbeb8282e1831273d0a9c445ae6.tar.gz YATwm-4b2507efc3721fbeb8282e1831273d0a9c445ae6.zip | |
Better error checking for config
Diffstat (limited to 'config.h')
| -rw-r--r-- | config.h | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -1,5 +1,9 @@ #pragma once +#include "error.h" + +#include <toml++/toml.hpp> + #include <X11/X.h> #include <X11/keysym.h> @@ -51,7 +55,9 @@ class Config ~Config(); void free(); - void loadFromFile(std::string path); + Err loadFromFile(std::string path); + Err reload(); + // Startup std::string* startupBash; int startupBashc; @@ -72,4 +78,16 @@ class Config // 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; }; |
