Single instance

This commit is contained in:
2026-10-18 16:59:51 +02:00
parent 798708b3e7
commit 74503c27dd
19 changed files with 670 additions and 99 deletions

View File

@@ -8,6 +8,15 @@
namespace gkeymapper::daemon {
// Key code for a single modifier bit (the "left" variants are enough), 0 when
// the bit is not a modifier.
unsigned short modifier_key_code(unsigned bit);
// Expands one shortcut step into the key codes to press: the modifiers first,
// then the key itself. Used by play() and by the KeyHold action, which has to
// release exactly the codes it pressed.
std::vector<unsigned short> step_key_codes(const gkeymapper::ShortcutStep& step);
// A virtual keyboard created through /dev/uinput. It is only used to replay
// shortcuts; the daemon never reads from it.
class UinputKeyboard {
@@ -30,6 +39,12 @@ public:
// passes them on unchanged instead of turning them into a mapping.
void tap(unsigned short code);
// Presses, respectively releases, all codes in one EV_SYN block (release in
// reverse order). Splitting press and release is what "keyhold" needs: the
// caller keeps the list and releases it when the G key comes up.
void press(const std::vector<unsigned short>& codes);
void release(const std::vector<unsigned short>& codes);
private:
void emit(unsigned short type, unsigned short code, int value);
void sync();