36 lines
978 B
C++
36 lines
978 B
C++
// gKeyMapper daemon - executes the mapping configured for a G key.
|
|
#ifndef GKEYMAPPER_DAEMON_ACTION_H
|
|
#define GKEYMAPPER_DAEMON_ACTION_H
|
|
|
|
#include <string>
|
|
|
|
#include "keymap.h"
|
|
#include "mapping.h"
|
|
#include "uinput_keyboard.h"
|
|
|
|
namespace gkeymapper::daemon {
|
|
|
|
class ActionRunner {
|
|
public:
|
|
// Opens the virtual keyboard and the keyboard layout. Without the virtual
|
|
// keyboard, "key" mappings are skipped but "command" mappings still work.
|
|
bool init();
|
|
|
|
void run(const gkeymapper::Mapping& mapping);
|
|
|
|
// Replays one key press + release. Used by the media-key passthrough, which
|
|
// is not a mapping: the keyboard reports mute/volume/play only on the
|
|
// interface the daemon holds, so they are forwarded verbatim.
|
|
void tap_key(unsigned short code);
|
|
|
|
private:
|
|
void run_command(const std::string& command);
|
|
|
|
UinputKeyboard keyboard_;
|
|
gkeymapper::Keymap keymap_;
|
|
};
|
|
|
|
} // namespace gkeymapper::daemon
|
|
|
|
#endif // GKEYMAPPER_DAEMON_ACTION_H
|