summaryrefslogtreecommitdiff
path: root/keybinds.h
diff options
context:
space:
mode:
authorBossCode45 <human.cyborg42@gmail.com>2023-05-26 21:46:19 +1200
committerBossCode45 <human.cyborg42@gmail.com>2023-05-26 21:46:19 +1200
commit27137ec9d29c36df8117869773203b243849896c (patch)
tree8f457bcc0862ecd176f5fc748b06f66e46082a2e /keybinds.h
parentda3b5b2131d2b4ff5cb127e92090fca568376835 (diff)
downloadYATwm-27137ec9d29c36df8117869773203b243849896c.tar.gz
YATwm-27137ec9d29c36df8117869773203b243849896c.zip
feat: Made keybinds work (I hope)
Note: the config file reloading keybinds isn't quite working, though, need to ungrab the keys
Diffstat (limited to 'keybinds.h')
-rw-r--r--keybinds.h34
1 files changed, 23 insertions, 11 deletions
diff --git a/keybinds.h b/keybinds.h
index d26b7a1..c0cc955 100644
--- a/keybinds.h
+++ b/keybinds.h
@@ -1,19 +1,31 @@
#pragma once
-#include <unordered_map>
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <map>
#include <string>
+#include <X11/keysym.h>
+#include <vector>
#include "commands.h"
+struct Keybind {
+ KeyCode key;
+ unsigned int modifiers;
+ std::string command;
+};
+
class KeybindsModule {
- public:
- KeybindsModule(CommandsModule& commandsModule);
- ~KeybindsModule() = default;
- const void bind(const CommandArg* argv);
- const void readBinds(const CommandArg* argv);
- const void exit(const CommandArg* argv);
- private:
- std::unordered_map<std::string, std::string> binds;
- bool exitNow;
- CommandsModule& commandsModule;
+public:
+ KeybindsModule(CommandsModule& commandsModule, Display* dpy, Window root);
+ ~KeybindsModule() = default;
+ const void bind(const CommandArg* argv);
+ const void exit(const CommandArg* argv);
+ const void handleKeypress(XKeyEvent e);
+private:
+ std::vector<Keybind> binds;
+ bool exitNow;
+ CommandsModule& commandsModule;
+ Display* dpy;
+ Window root;
};