rethocker 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -23,7 +23,7 @@ const rk = rethocker([
23
23
  remap: Key.escape,
24
24
  },
25
25
 
26
- // Remap a chord to another chord single key or a whole sequence
26
+ // Remap key to key, chord to key, key to chord, or even chord to chord (type any sequence you want)
27
27
  // Use Key.* constants for autocomplete and safe string interpolation
28
28
  {
29
29
  key: "Ctrl+H E",
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rethocker",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Intercept and remap global keys on macOS — with per-app, per-device, and key-sequence support",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -64,11 +64,6 @@ function registerRemap(
64
64
  rule: RemapRule,
65
65
  ): RuleHandle {
66
66
  const parsed = parseKey(rule.key);
67
- if (parsed.kind === "sequence") {
68
- throw new Error(
69
- `remap does not support sequences as trigger: "${rule.key}"`,
70
- );
71
- }
72
67
  const target = parseKey(rule.remap);
73
68
  const action =
74
69
  target.kind === "sequence"
@@ -78,10 +73,21 @@ function registerRemap(
78
73
  keyCode: target.combo.keyCode,
79
74
  modifiers: target.combo.modifiers,
80
75
  } as const);
81
- return addRule(send, parsed.combo, action, {
76
+
77
+ if (parsed.kind === "single") {
78
+ return addRule(send, parsed.combo, action, {
79
+ id: rule.id,
80
+ conditions: buildConditions(rule),
81
+ disabled: rule.disabled,
82
+ });
83
+ }
84
+
85
+ // Sequence trigger: intercept the full sequence then post the remap target
86
+ return addSequence(send, parsed.steps, action, {
82
87
  id: rule.id,
83
- conditions: buildConditions(rule),
88
+ conditions: rule.conditions,
84
89
  disabled: rule.disabled,
90
+ consume: true, // always consume — we're replacing the sequence
85
91
  });
86
92
  }
87
93
 
@@ -20,9 +20,9 @@ const rk = rethocker([
20
20
  remap: "escape",
21
21
  },
22
22
  {
23
- // you can also remap chords
23
+ // remap from a chord to a sequence of keys (chord to chord!)
24
24
  key: "Ctrl+H E",
25
- // or remap to a chord, use `Key` for autocomplete and typesafety
25
+ // use `Key` for autocomplete and typesafety
26
26
  remap: `h e l l o Shift+n1 n1 ${Key.delete}`,
27
27
  },
28
28
  {