summaryrefslogtreecommitdiff
path: root/config.cpp
diff options
context:
space:
mode:
authorBossCode45 <human.cyborg42@gmail.com>2022-12-21 17:25:20 +1300
committerBossCode45 <human.cyborg42@gmail.com>2022-12-21 17:25:20 +1300
commitf7ca0146ba7fed288c34040db0c2eae1683cf461 (patch)
tree76c7bc201dd12d1ae44deaded822d6cb0f78b91c /config.cpp
parentb116028a645d7db75d93c359462112ac4ad8d5ad (diff)
downloadYATwm-f7ca0146ba7fed288c34040db0c2eae1683cf461.tar.gz
YATwm-f7ca0146ba7fed288c34040db0c2eae1683cf461.zip
Config file working - more tests and potentially features before merge with main though
Diffstat (limited to 'config.cpp')
-rw-r--r--config.cpp59
1 files changed, 19 insertions, 40 deletions
diff --git a/config.cpp b/config.cpp
index 097287c..5934f21 100644
--- a/config.cpp
+++ b/config.cpp
@@ -1,5 +1,7 @@
#include "config.h"
+#include "util.h"
+
#include <X11/Xlib.h>
#include <string>
@@ -15,38 +17,19 @@ using std::map, std::string;
// For testing
using std::cout, std::endl, std::cerr;
-void exit(const KeyArg arg)
-{
- cout << "exit called" << endl;
-}
-void spawn(const KeyArg arg)
-{
- cout << "spawn called " << arg.str << endl;
-}
-void changeWS(const KeyArg arg)
-{
- cout << "changeWS called" << endl;
-}
-void wToWS(const KeyArg arg)
-{
- cout << "wToWS called" << endl;
-}
-void focChange(const KeyArg arg)
-{
- cout << "focChange called" << endl;
-}
-void reload(const KeyArg arg)
-{
- cout << "reload called" << endl;
-}
-
map<string, void(*) (const KeyArg arg)> funcNameMap = {
{"exit", exit},
{"spawn", spawn},
+ {"toggle", toggle},
+ {"kill", kill},
{"changeWS", changeWS},
{"wToWS", wToWS},
{"focChange", focChange},
- {"reload", reload}
+ {"wMove", wMove},
+ {"bashSpawn", bashSpawn},
+ {"reload", reload},
+ {"wsDump", wsDump},
+ {"nextMonitor", nextMonitor},
};
@@ -54,18 +37,6 @@ Config::Config()
{
}
-std::vector<string> split (const string &s, char delim) {
- std::vector<string> result;
- std::stringstream ss (s);
- string item;
-
- while (getline (ss, item, delim)) {
- result.push_back (item);
- }
-
- return result;
-}
-
void Config::loadFromFile(string path)
{
//free();
@@ -144,22 +115,30 @@ void Config::loadFromFile(string path)
}
//Keybinds
+ bool swapSuperAlt = tbl["Keybinds"]["swapSuperAlt"].value_or<bool>(false);
bindsc = tbl["Keybinds"]["key"].as_array()->size();
binds = new KeyBind[bindsc];
for(int i = 0; i < bindsc; i++)
{
KeyBind bind;
+ bind.modifiers = 0;
const string bindString = *tbl["Keybinds"]["key"][i]["bind"].value<string>();
std::vector<string> keys = split(bindString, '+');
for(string key : keys)
{
if(key == "mod")
{
- bind.modifiers |= Mod4Mask;
+ if(!swapSuperAlt)
+ bind.modifiers |= Mod4Mask;
+ else
+ bind.modifiers |= Mod1Mask;
}
else if(key == "alt")
{
- bind.modifiers |= Mod1Mask;
+ if(swapSuperAlt)
+ bind.modifiers |= Mod4Mask;
+ else
+ bind.modifiers |= Mod1Mask;
}
else if(key == "shift")
{