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

@@ -17,6 +17,8 @@ const char* action_type_token(ActionType type) {
return "key";
case ActionType::Command:
return "command";
case ActionType::KeyHold:
return "keyhold";
case ActionType::Disabled:
default:
return "disabled";
@@ -30,6 +32,9 @@ ActionType action_type_from_token(const std::string& token) {
if (token == "command") {
return ActionType::Command;
}
if (token == "keyhold") {
return ActionType::KeyHold;
}
return ActionType::Disabled;
}

View File

@@ -5,6 +5,7 @@
// G1=key:ctrl+c,ctrl+v
// G2=command:/usr/bin/firefox
// G3=disabled:
// G4=keyhold:ctrl+w (held down while G4 is held down)
#ifndef GKEYMAPPER_MAPPING_H
#define GKEYMAPPER_MAPPING_H
@@ -16,7 +17,10 @@ namespace gkeymapper {
constexpr int kNumKeys = 9; // G1..G9
enum class ActionType { Disabled, Key, Command };
// KeyHold keeps its keys down until the G key is released; the others fire once
// on the press. The order is not part of the file format (the tokens are), but
// keep it stable: the GUI maps dropdown indices explicitly.
enum class ActionType { Disabled, Key, Command, KeyHold };
struct Mapping {
ActionType type = ActionType::Disabled;