YggdrasilWM  0.1.1
A tiny window manager coded in C++
Binding.hpp
Go to the documentation of this file.
1 
27 #ifndef YGGDRASILWM_BINDING_H
28 #define YGGDRASILWM_BINDING_H
29 #include <string>
30 #include "Commands/CommandBase.hpp"
31 extern "C" {
32 #include <X11/Xlib.h>
33 }
34 class BaseX11Wrapper;
39 class Binding {
40 public:
41  Binding();
42  ~Binding();
51  void init(std::string Mod, std::string Key, std::string Command, std::string Args);
58  void init_keycode(Display *display, BaseX11Wrapper *x11Wrapper);
64  void execute(const XKeyEvent *);
65  [[nodiscard]] const std::string & getMod() const;
66  [[nodiscard]] const std::string & getKey() const;
67  [[nodiscard]] const std::string & getCommandName() const;
68  [[nodiscard]] const std::string & getArgs() const;
69  [[nodiscard]] unsigned int getModMask() const;
70  [[nodiscard]] int getKeyCode() const;
71 private:
72  std::string mod_;
73  unsigned int modMask_;
74  std::string key_;
75  int keyCode_;
76  std::string commandName_;
77  std::string args_;
79 };
80 #endif //YGGDRASILWM_BINDING_H
CommandBase class header.
Definition: baseX11Wrapper.hpp:37
Binding store a binding to a command object.
Definition: Binding.hpp:39
std::string key_
Definition: Binding.hpp:74
void init_keycode(Display *display, BaseX11Wrapper *x11Wrapper)
Initialize the keycode of the binding had to be initialized after the display is opened.
Definition: Binding.cpp:93
~Binding()
Definition: Binding.cpp:108
CommandBase * command_
Definition: Binding.hpp:78
void execute(const XKeyEvent *)
Execute the command linked to the binding The arguments passed to the command are the one stored in t...
Definition: Binding.cpp:65
void init(std::string Mod, std::string Key, std::string Command, std::string Args)
Initialize a binding all the parameters are read from the Json::Value from the configuration file Mod...
Definition: Binding.cpp:41
int getKeyCode() const
Definition: Binding.cpp:91
unsigned int getModMask() const
Definition: Binding.cpp:90
Binding()
Definition: Binding.cpp:78
const std::string & getMod() const
Definition: Binding.cpp:86
std::string args_
Definition: Binding.hpp:77
const std::string & getArgs() const
Definition: Binding.cpp:89
const std::string & getKey() const
Definition: Binding.cpp:87
const std::string & getCommandName() const
Definition: Binding.cpp:88
std::string commandName_
Definition: Binding.hpp:76
std::string mod_
Definition: Binding.hpp:72
unsigned int modMask_
Definition: Binding.hpp:73
int keyCode_
Definition: Binding.hpp:75
Definition: CommandBase.hpp:35