summaryrefslogtreecommitdiff
path: root/config.h
diff options
context:
space:
mode:
authorBossCode45 <human.cyborg42@gmail.com>2022-12-18 15:20:52 +1300
committerBossCode45 <human.cyborg42@gmail.com>2022-12-18 15:20:52 +1300
commitb116028a645d7db75d93c359462112ac4ad8d5ad (patch)
tree82cc41deafa69e50d49e0f97f6c5262638048ba8 /config.h
parent0589c777bbec1a98ab70b0aaa56c9c896bd57859 (diff)
downloadYATwm-b116028a645d7db75d93c359462112ac4ad8d5ad.tar.gz
YATwm-b116028a645d7db75d93c359462112ac4ad8d5ad.zip
Started to implement a config file
Diffstat (limited to 'config.h')
-rw-r--r--config.h137
1 files changed, 37 insertions, 100 deletions
diff --git a/config.h b/config.h
index f080670..cfcf5bd 100644
--- a/config.h
+++ b/config.h
@@ -1,40 +1,10 @@
#pragma once
+#include <X11/X.h>
#include <X11/keysym.h>
-#include <X11/Xlib.h>
-#include <vector>
#include <string>
-//Startup
-const std::string startup[] = {
- //"picom -fD 3",
- "feh --bg-scale /usr/share/backgrounds/vapor_trails_blue.png",
- //"~/.config/polybar/launch.sh",
- //"emacs --daemon"
-};
-
-//Main config
-// Sensible gaps
-const int gaps = 3;
-const int outerGaps = 3;
-// Huge gaps
-/*
-const int gaps = 20;
-const int outerGaps = 30;
-*/
-
-const std::string logFile = "/tmp/yatlog.txt";
-
-//WS config
-const int numWS = 10;
-const std::string workspaceNames[] = {"1: ", "2: 拾", "3: ", "4: ", "5: ", "6: ", "7: 拾", "8: ", "9: ", "10: "};
-//If you have more then 2 monitors change the number below
-const int maxMonitors = 2;
-const int screenPreferences[][maxMonitors] = {{0}, {0}, {0}, {0}, {0}, {1, 0}, {1, 0}, {1, 0}, {1, 0}, {1, 0}};
-
-//Keys
-//The types and perhaps functions likely to be moved to seperate header file later
enum MoveDir
{
Up,
@@ -45,17 +15,17 @@ enum MoveDir
typedef union
{
- const char** str;
- const int num;
- const MoveDir dir;
+ char* str;
+ int num;
+ MoveDir dir;
} KeyArg;
-struct Key
+struct KeyBind
{
- const unsigned int modifiers;
- const KeySym keysym;
- void (*function)(const KeyArg arg);
- const KeyArg arg;
+ unsigned int modifiers;
+ KeySym keysym;
+ void(* func) (const KeyArg arg);
+ KeyArg args;
};
//Keybind commands
@@ -74,65 +44,32 @@ KEYCOM(reload);
KEYCOM(wsDump);
KEYCOM(nextMonitor);
-// Super key mod
-#define MOD Mod4Mask
-#define ALT Mod1Mask
-// Alt key mod
-// #define MOD Mod1Mask
-#define SHIFT ShiftMask
-
-// Programs to run for keybinds
-const char* alacritty[] = {"alacritty", NULL};
-const char* rofi[] = {"rofi", "-i", "-show", "drun", NULL};
-const char* qutebrowser[] = {"qutebrowser", NULL};
-const char* i3lock[] = {"i3lock", "-eti", "/usr/share/backgrounds/lockscreen.png", NULL};
-const char* suspend[] = {"systemctl", "suspend", NULL};
-
-// Scripts to run for keybinds
-// Script I made to run an xrandr command
-const char* monConfig[] = {"~/.yat_commands/monitor-config.sh"};
-
-
-#define WSKEY(K, X) \
- {MOD, K, changeWS, {.num = X}}, \
- {MOD|SHIFT, K, wToWS, {.num = X}}
-
-const Key keyBinds[] = {
- // Modifiers //Key //Func //Args
- // General
- {MOD, XK_e, exit, {NULL}},
- {MOD, XK_Return, spawn, {.str = alacritty}},
- {MOD, XK_d, spawn, {.str = rofi}},
- {MOD, XK_t, toggle, {NULL}},
- {MOD, XK_q, kill, {NULL}},
- {MOD, XK_c, spawn, {.str = qutebrowser}},
- {MOD, XK_x, spawn, {.str = i3lock}},
- {MOD|SHIFT, XK_x, spawn, {.str = i3lock}},
- {MOD|SHIFT, XK_x, spawn, {.str = suspend}},
- {MOD, XK_m, bashSpawn, {.str = monConfig}},
- {MOD|SHIFT, XK_r, reload, {NULL}},
- // Testing
- {MOD, XK_p, wsDump, {NULL}},
- // Focus
- {MOD, XK_h, focChange, {.dir = Left}},
- {MOD, XK_j, focChange, {.dir = Down}},
- {MOD, XK_k, focChange, {.dir = Up}},
- {MOD, XK_l, focChange, {.dir = Right}},
- {ALT, XK_Tab, nextMonitor, {NULL}},
- // Window moving
- {MOD|SHIFT, XK_h, wMove, {.dir = Left}},
- {MOD|SHIFT, XK_j, wMove, {.dir = Down}},
- {MOD|SHIFT, XK_k, wMove, {.dir = Up}},
- {MOD|SHIFT, XK_l, wMove, {.dir = Right}},
- // Workspaces
- WSKEY(XK_1, 1),
- WSKEY(XK_2, 2),
- WSKEY(XK_3, 3),
- WSKEY(XK_4, 4),
- WSKEY(XK_5, 5),
- WSKEY(XK_6, 6),
- WSKEY(XK_7, 7),
- WSKEY(XK_8, 8),
- WSKEY(XK_9, 9),
- WSKEY(XK_0, 10),
+class Config
+{
+ public:
+ Config();
+ ~Config();
+ void free();
+
+ void loadFromFile(std::string path);
+ // 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;
};