rethocker 0.1.5 → 0.2.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.
Files changed (3) hide show
  1. package/README.md +26 -50
  2. package/package.json +1 -1
  3. package/src/cli.ts +3 -3
package/README.md CHANGED
@@ -6,6 +6,27 @@ Requires **macOS 13+** and **Accessibility permission** (prompted automatically
6
6
 
7
7
  ## Install
8
8
 
9
+ ### Homebrew (recommended)
10
+
11
+ ```bash
12
+ brew tap benjamine/tap
13
+ brew install rethocker
14
+ rethocker install
15
+ ```
16
+
17
+ `rethocker install` scaffolds `~/.config/rethocker/default.ts` and registers a LaunchAgent that starts on login and auto-reloads whenever you save the file.
18
+
19
+ ```bash
20
+ rethocker log # live key monitor — see what rethocker captures
21
+ rethocker status # check if the background agent is running
22
+ rethocker restart # restart the background agent
23
+ rethocker uninstall # stop and remove the LaunchAgent (run before brew uninstall)
24
+ ```
25
+
26
+ ### Programmatic use (TypeScript / Bun)
27
+
28
+ If you want to use rethocker as a library in your own TypeScript project:
29
+
9
30
  ```bash
10
31
  bun add rethocker
11
32
  ```
@@ -232,6 +253,8 @@ actions.window.thirdCenter()
232
253
  actions.window.thirdRight()
233
254
  actions.window.quarterTopLeft()
234
255
  actions.window.maximize()
256
+
257
+ // NOTE: you can use this to compose any custom layouts
235
258
  actions.window.halfLeft("Figma") // move specific app
236
259
 
237
260
  // App management
@@ -251,8 +274,6 @@ actions.media.volumeDown(10)
251
274
  // System
252
275
  actions.system.sleep()
253
276
  actions.system.lockScreen()
254
- actions.system.missionControl()
255
- actions.system.emptyTrash()
256
277
 
257
278
  // Run a Shortcut from the macOS Shortcuts app
258
279
  actions.shortcut("My Shortcut Name")
@@ -302,13 +323,13 @@ rk.remove("caps-remap")
302
323
 
303
324
  ## Discover key codes
304
325
 
305
- Run the included debug script to see what keys produce:
326
+ Run the live key monitor to see every keypress in rethocker rule syntax:
306
327
 
307
328
  ```bash
308
- bun node_modules/rethocker/src/scripts/debug-keys.ts
329
+ rethocker log
309
330
  ```
310
331
 
311
- Output shows keyCode, modifiers, and active app for every keypress useful for finding the right key name or checking that app filters work correctly.
332
+ Keys pressed in quick succession appear on the same line separated by spaces, exactly as you'd write them in a rule. Useful for finding the right key name or verifying that app filters work correctly.
312
333
 
313
334
  ## Events and lifecycle
314
335
 
@@ -344,48 +365,3 @@ await rk.stop()
344
365
  // (by default rethocker keeps the event loop alive)
345
366
  rk.unref()
346
367
  ```
347
-
348
- ## API reference
349
-
350
- ### `rethocker(rules?, options?)` → `RethockerHandle`
351
-
352
- | Option | Type | Description |
353
- |---|---|---|
354
- | `binaryPath` | `string?` | Override the native binary path |
355
-
356
- ### `RethockerHandle`
357
-
358
- | Method | Returns | Description |
359
- |---|---|---|
360
- | `add(rule \| rule[])` | `void` | Add one or more rules |
361
- | `remove(id)` | `void` | Remove a rule permanently |
362
- | `enable(id?)` | `void` | Enable a rule by ID, or all rules if no ID |
363
- | `disable(id?)` | `void` | Disable a rule by ID, or all rules if no ID |
364
- | `on(event, listener)` | `() => void` | Subscribe to an event; returns an unsubscribe function |
365
- | `execute(command)` | `Promise<void>` | Run a shell command immediately (accepts `string \| string[]`) |
366
- | `start()` | `Promise<void>` | Await daemon readiness (optional) |
367
- | `stop()` | `Promise<void>` | Stop the daemon |
368
- | `unref()` | `void` | Allow the process to exit while the daemon runs |
369
- | `ready` | `boolean` | Whether the daemon is ready |
370
-
371
- ### Events
372
-
373
- | Event | Arguments | Description |
374
- |---|---|---|
375
- | `"ready"` | — | Daemon ready |
376
- | `"key"` | `KeyEvent` | Every key event (stream auto-activates on subscribe) |
377
- | `"accessibilityDenied"` | — | Accessibility permission not granted |
378
- | `"error"` | `code, message` | Native daemon error |
379
- | `"exit"` | `code` | Native process exited unexpectedly |
380
-
381
- ### `KeyEvent`
382
-
383
- | Field | Type | Description |
384
- |---|---|---|
385
- | `type` | `"keydown" \| "keyup" \| "flags"` | Event type |
386
- | `keyCode` | `number` | macOS virtual key code |
387
- | `modifiers` | `Modifier[]` | Active modifiers |
388
- | `app` | `string?` | Frontmost app display name |
389
- | `appBundleID` | `string?` | Frontmost app bundle ID |
390
- | `suppressed` | `boolean` | Whether the key was consumed |
391
- | `ruleID` | `string?` | ID of the matched rule |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rethocker",
3
- "version": "0.1.5",
3
+ "version": "0.2.1",
4
4
  "description": "Intercept and remap global keys on macOS — with per-app and key-sequence support",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/cli.ts CHANGED
@@ -196,10 +196,10 @@ Commands:
196
196
  so you can copy-paste them directly into your config
197
197
  help Print this help message
198
198
 
199
- Examples:
199
+ Install via Homebrew:
200
+ brew tap benjamine/tap
201
+ brew install rethocker
200
202
  rethocker install
201
- rethocker log
202
- rethocker status
203
203
 
204
204
  Docs: ${GITHUB}
205
205
  `.trim();