Binding store a binding to a command object.
More...
#include <Binding.hpp>
|
| Binding () |
|
| ~Binding () |
|
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 is parsed to store the proper modMask Command is parsed to link the proper command object. More...
|
|
void | init_keycode (Display *display, BaseX11Wrapper *x11Wrapper) |
| Initialize the keycode of the binding had to be initialized after the display is opened. More...
|
|
void | execute (const XKeyEvent *) |
| Execute the command linked to the binding The arguments passed to the command are the one stored in the binding. More...
|
|
const std::string & | getMod () const |
|
const std::string & | getKey () const |
|
const std::string & | getCommandName () const |
|
const std::string & | getArgs () const |
|
unsigned int | getModMask () const |
|
int | getKeyCode () const |
|
Binding store a binding to a command object.
◆ Binding()
std::string key_
Definition: Binding.hpp:74
CommandBase * command_
Definition: Binding.hpp:78
std::string args_
Definition: Binding.hpp:77
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
◆ ~Binding()
◆ execute()
void Binding::execute |
( |
const XKeyEvent * |
event = nullptr | ) |
|
Execute the command linked to the binding The arguments passed to the command are the one stored in the binding.
67 if (event ==
nullptr) {
71 ss <<
args_ <<
"," <<
event->subwindow <<
"," <<
event->window <<
"," <<
event->state <<
"," <<
event->keycode;
76 throw std::runtime_error(
"Command not initialized.");
virtual void execute(const std::string &args)=0
Each child class must implement this interface.
References args_, command_, and CommandBase::execute().
◆ getArgs()
const std::string & Binding::getArgs |
( |
| ) |
const |
◆ getCommandName()
const std::string & Binding::getCommandName |
( |
| ) |
const |
◆ getKey()
const std::string & Binding::getKey |
( |
| ) |
const |
◆ getKeyCode()
int Binding::getKeyCode |
( |
| ) |
const |
◆ getMod()
const std::string & Binding::getMod |
( |
| ) |
const |
◆ getModMask()
unsigned int Binding::getModMask |
( |
| ) |
const |
◆ init()
void Binding::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 is parsed to store the proper modMask Command is parsed to link the proper command object.
- Note
- you need to call init_keycode after the display is opened
55 throw std::runtime_error(
"Unknown command: " +
commandName_);
59 }
else if (
mod_ ==
"Mod1") {
62 throw std::runtime_error(
"Unknown mod : " +
mod_);
FocusGroup implement the mecanism to switch between group.
Definition: FocusGroup.hpp:34
Grow a window.
Definition: Grow.hpp:45
Quit implement the mecanism to quit the window manager.
Definition: Quit.hpp:35
Implement the mecanism to spawn a program.
Definition: Spawn.hpp:34
References args_, command_, commandName_, key_, mod_, and modMask_.
◆ init_keycode()
void Binding::init_keycode |
( |
Display * |
display, |
|
|
BaseX11Wrapper * |
x11Wrapper |
|
) |
| |
Initialize the keycode of the binding had to be initialized after the display is opened.
- Parameters
-
@ L_INFO
Definition: Logger.hpp:49
virtual int keysymToKeycode(Display *display, int keysym)=0
virtual KeySym stringToKeysym(const char *string)=0
virtual void Log(const std::string &message, LogLevel level) const
Log a message This method logs a message to the log file or stream. The message is only logged if the...
Definition: Logger.cpp:73
static Logger * GetInstance()
Get the Logger object.
Definition: Logger.cpp:41
References args_, commandName_, Logger::GetInstance(), key_, keyCode_, BaseX11Wrapper::keysymToKeycode(), L_INFO, Logger::Log(), mod_, and BaseX11Wrapper::stringToKeysym().
◆ args_
std::string Binding::args_ |
|
private |
◆ command_
◆ commandName_
std::string Binding::commandName_ |
|
private |
◆ key_
std::string Binding::key_ |
|
private |
◆ keyCode_
◆ mod_
std::string Binding::mod_ |
|
private |
◆ modMask_
unsigned int Binding::modMask_ |
|
private |
The documentation for this class was generated from the following files: