diff options
| author | BossCode45 <human.cyborg42@gmail.com> | 2023-05-26 21:46:19 +1200 |
|---|---|---|
| committer | BossCode45 <human.cyborg42@gmail.com> | 2023-05-26 21:46:19 +1200 |
| commit | 27137ec9d29c36df8117869773203b243849896c (patch) | |
| tree | 8f457bcc0862ecd176f5fc748b06f66e46082a2e /keybinds.h | |
| parent | da3b5b2131d2b4ff5cb127e92090fca568376835 (diff) | |
| download | YATwm-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.h | 34 |
1 files changed, 23 insertions, 11 deletions
@@ -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; }; |
