From 27137ec9d29c36df8117869773203b243849896c Mon Sep 17 00:00:00 2001 From: BossCode45 Date: Fri, 26 May 2023 21:46:19 +1200 Subject: feat: Made keybinds work (I hope) Note: the config file reloading keybinds isn't quite working, though, need to ungrab the keys --- keybinds.h | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'keybinds.h') 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 +#include +#include +#include #include +#include +#include #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 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 binds; + bool exitNow; + CommandsModule& commandsModule; + Display* dpy; + Window root; }; -- cgit v1.2.3