summaryrefslogtreecommitdiff
path: root/config.h
diff options
context:
space:
mode:
authorBossCode45 <human.cyborg42@gmail.com>2023-05-24 10:28:49 +1200
committerBossCode45 <human.cyborg42@gmail.com>2023-05-24 10:28:49 +1200
commitda3b5b2131d2b4ff5cb127e92090fca568376835 (patch)
tree3c3ca1dbb19683a22eefde705f2d8ac4d62ffdc3 /config.h
parent6655d5dfb24ca3fd36b02550c526bca1f5d924e9 (diff)
downloadYATwm-da3b5b2131d2b4ff5cb127e92090fca568376835.tar.gz
YATwm-da3b5b2131d2b4ff5cb127e92090fca568376835.zip
in-progress: Config refactor started, changed all existing keybind command args and added in the new files, still many errors
Diffstat (limited to 'config.h')
-rw-r--r--config.h85
1 files changed, 28 insertions, 57 deletions
diff --git a/config.h b/config.h
index 31005e7..3956492 100644
--- a/config.h
+++ b/config.h
@@ -1,63 +1,30 @@
#pragma once
-#include "error.h"
-
-#include <toml++/toml.hpp>
-
+#include "commands.h"
#include <X11/X.h>
#include <X11/keysym.h>
#include <string>
-enum MoveDir
+struct Workspace
{
- Up,
- Right,
- Down,
- Left
+ std::string name;
+ int* screenPreferences;
+ int screenPreferencesc;
};
-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);
+#define COMMAND(X) \
+ const void X (const CommandArg* argv)
class Config
-{
+{
public:
- Config();
+ Config(CommandsModule& commandsModule);
~Config();
void free();
- Err loadFromFile(std::string path);
- Err reload();
-
+ void loadFromFile(std::string path);
+ void reloadFile();
// Startup
std::string* startupBash;
int startupBashc;
@@ -68,6 +35,7 @@ class Config
std::string logFile;
// Workspaces
+ std::vector<Workspace> workspaces;
int numWS;
std::string* workspaceNames;
int workspaceNamesc;
@@ -75,19 +43,22 @@ class Config
int** screenPreferences;
int screenPreferencesc;
- // Keybinds
- KeyBind* binds;
- int bindsc;
+ // Config Commands
+ COMMAND(gapsCmd);
+ COMMAND(outerGapsCmd);
+ COMMAND(logFileCmd);
+ COMMAND(addWorkspaceCmd);
+
+ // Keybind Commands
+ COMMAND(exit);
+ COMMAND(spawn);
+ COMMAND(spawn_once);
+ COMMAND(changeWS);
+ COMMAND(wToWS);
+ COMMAND(focChange);
+ COMMAND(reload);
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;
-
+ CommandsModule& commandsModule;
bool loaded = false;
- std::string path;
+ std::string file;
};