HACHACON

Configure with AI

Instead of writing config.json yourself, you can have an AI such as ChatGPT or Claude write it. The prompt below contains everything about HACHACON’s config format, plus the built-in config.

How to use it

  1. Copy the prompt with the button below and paste it into an AI chat
  2. Under “What I want” at the end, describe what you want. Paste your current config.json too, if you have one
  3. Save the JSON it gives you over config.json in your config folder (open it with Reveal Config Folder in Finder in the menu bar)
  4. CONFIG RELOADED at the bottom of the screen means it worked. If you see CONFIG ERROR · LINE 42, give the AI the reason shown on the ⚠ line in the menu and ask it to fix it

Example requests

The prompt

206 lines
You are helping me write `config.json` for HACHACON, a macOS menu bar app that turns a game controller (usually a PS5 DualSense) into keyboard and mouse input. If my request is unclear, ask me short questions first. Then output the complete `config.json`.

# Output rules

- Output one complete JSON object in a single ```json code block. Standard JSON only: no comments, no trailing commas.
- Use only the keys, button names, action types, and key names listed below. An unknown button name or action type makes the whole file fail to load.
- Keep everything I did not ask to change. If I paste my current `config.json`, edit that. Otherwise start from the built-in config at the end of this prompt.
- After the JSON, explain in a few lines what changed and what each changed button now does. Also list anything I must set up outside HACHACON (a shortcut in the Shortcuts app, a keyboard shortcut for Dictation, `Set Up Shell Script…` for `shell`).

# Top-level keys

- `startLayer`: name of the layer active at launch
- `debug`: true logs every button press
- `mouse`: `{ "speed": px/s at full tilt, "curve": exponent (higher = slower small tilts), "deadzone": 0–1 }`
- `scroll`: same as `mouse`, plus `"natural": true|false`
- `repeat`: `{ "delay": seconds before key repeat starts, "interval": seconds between repeats }`
- `voice`: `{ "device": input device name to switch to (partial match), "light": "#rrggbb" light bar color during voice input }`
- `hud`: `{ "enabled": bool }` on-screen layer names and messages
- `haptics`: `{ "enabled": bool, "intensity": 0–1 }`
- `inputViewer`: `{ "enabled": bool, "corner": "bottomRight"|"bottomLeft"|"topRight"|"topLeft", "scale": 0.5–3 }`
- `menus`: ring menus (below)
- `appMenus`: per-app ring menus (below)
- `layers`: layers (below)

# Layers

```
"layers": {
  "<layer name>": {
    "light": "#rrggbb",
    "fallback": "<another layer name>",
    "leftStick": <stick>, "rightStick": <stick>,
    "buttons": { "<button name>": <action> }
  }
}
```

- `startLayer` and every `fallback` must name a layer that exists. Avoid fallback loops.
- A button or stick not set in a layer uses the `fallback` layer's assignment. `{ "type": "none" }` cancels it.
- Typical pattern: everyday assignments in `base`; hold L1 to switch to another layer that only lists the buttons that change and has `"fallback": "base"`.
- While a `hold` layer is held, `toggle`/`set` to another layer takes effect only after release.

# Button names

Face buttons are named by position. Names are case-insensitive.

| name | DualSense | Xbox |
|---|---|---|
| `south` `east` `west` `north` | ✕ ○ □ △ | A B X Y |
| `l1` `r1` / `l2` `r2` / `l3` `r3` | L1 R1 / L2 R2 / stick clicks | LB RB / LT RT / stick clicks |
| `dpadUp` `dpadDown` `dpadLeft` `dpadRight` | D-pad | D-pad |
| `menu` / `view` | Options / Create | Menu / View |
| `home` | PS | Xbox |

- Touchpad (DualSense, DualShock 4): `touchpadLeft` `touchpadRight` (pressing the touchpad, split by left/right half; can be held). `swipeUp` `swipeDown` `swipeLeft` `swipeRight` (one-finger swipes; fire once when the finger lifts, so `precision` and `voice` do nothing there, a `layer` with `hold` acts as `set`, and a `menu` with `hold` acts as `toggle`).
- Do not use `home`: on macOS 26 the system takes the PS button and it never reaches the app.
- Old names such as `cross`, `circle`, `square`, `triangle`, `options`, `share`, `ps`, `a`, `b`, `lb`, `up` are errors.

# Sticks

`"mouse"` (pointer), `"scroll"`, `"arrows"` (arrow keys, repeat while held), `"none"`, or a key per direction: `{ "up": "k", "down": "j", "left": "h", "right": "l" }`.

# Actions

A button action starts when pressed and ends when released.

- `{ "type": "key", "key": "cmd+shift+4", "repeat": true }`: holds the key while the button is held; `repeat` (optional) auto-repeats. A modifier alone (`"key": "cmd"`) acts as a held modifier that combines with other buttons and clicks.
- `{ "type": "mouse", "button": "left"|"right"|"middle", "clicks": 2 }`: the mouse button stays down while held (drag with the stick). `clicks` optional.
- `{ "type": "layer", "name": "nav", "mode": "hold"|"toggle"|"set" }`
- `{ "type": "precision", "factor": 0.3 }`: multiplies pointer and scroll speed while held.
- `{ "type": "voice", "key": "f5", "mode": "toggle"|"hold", "mic": true }`: voice input. `toggle` (default) presses the shortcut on press and again on release; `hold` keeps it pressed (push-to-talk apps). `mic` switches the Mac's input to `voice.device` while held (DualSense mic works only over USB).
- `{ "type": "menu", "name": "main", "mode": "hold"|"toggle" }`: opens a ring menu. `hold`: release to run. `toggle`: press again to run.
- `{ "type": "appMenu", "mode": "hold"|"toggle" }`: opens the ring menu for the app under the pointer (from `appMenus`).
- `{ "type": "open", "app": "Safari" }` or `{ "type": "open", "url": "https://example.com" }`: app name or bundle ID, or a URL. Use this rather than `shell` to open apps and URLs.
- `{ "type": "shortcut", "name": "Run Command", "input": "git -C ~/work pull" }`: runs a shortcut from the Shortcuts app by name; `input` (optional text) is passed to it. Preferred way to run commands.
- `{ "type": "shell", "command": "open ~/Downloads" }`: runs a shell command. Advanced: needs a one-time `Set Up Shell Script…` from the menu bar. Use absolute paths for Homebrew commands.
- `{ "type": "none" }`

# Key names

US layout names: `a`–`z`, `0`–`9`, `f1`–`f20`, `space` `enter` `tab` `escape` `backspace` `forwarddelete` `up` `down` `left` `right` `home` `end` `pageup` `pagedown`, symbols `-` `=` `[` `]` `;` `'` `,` `.` `/` `\` `` ` ``, JIS `eisu` `kana` `yen` `underscore`. Modifiers `cmd` (`win`), `shift`, `alt` (`option`), `ctrl`, `fn`, joined with `+` (`cmd+shift+4`).

# Ring menus

```
"menus": {
  "<menu name>": {
    "color": "#rrggbb",
    "stick": "right",
    "items": [ { "label": "Spotlight", "icon": "magnifyingglass", "action": { "type": "key", "key": "cmd+space" } } ]
  }
}
```

- 1 to 10 items, placed clockwise starting at the top. Pick with `stick` (`"left"` or `"right"`, default right; sub-rings use the root's stick).
- `icon` (optional): an SF Symbols name, or an image in the config folder written as `"./icons/name.png"`. Without it the label is shown.
- `preview` (optional): an image shown large outside the ring while the item is selected, relative to the config folder (`"previews/a.png"`).
- `action`: any action except `appMenu`. A `menu` action opens a sub-ring. Item actions run as a quick press and release (a `layer` with `hold` acts as `set`).
- Every `menu` name used in buttons, items, and `appMenus` must exist in `menus`.

`"appMenus": { "Google Chrome": "chrome", "Code": "vscode" }` maps an app name, exactly as shown in the macOS menu bar (case-sensitive), to a menu. Visual Studio Code is `Code`. On Japanese macOS, Apple apps have Japanese names (`メモ`, `カレンダー`). If unsure, tell me to press the `appMenu` button over the app: HACHACON shows `NO MENU  <app name>` with the exact name.

# Built-in config

```json
{
  "startLayer": "base",
  "debug": false,
  "mouse": { "speed": 1400, "curve": 2.0, "deadzone": 0.12 },
  "scroll": { "speed": 900, "curve": 1.6, "deadzone": 0.15, "natural": false },
  "repeat": { "delay": 0.35, "interval": 0.04 },
  "voice": { "device": "DualSense", "light": "#ff3030" },
  "hud": { "enabled": true },
  "inputViewer": { "enabled": false, "corner": "bottomRight", "scale": 1.0 },
  "haptics": { "enabled": true, "intensity": 1.0 },
  "menus": {
    "main": {
      "color": "#ff3060",
      "items": [
        { "label": "Spotlight",       "icon": "magnifyingglass",   "action": { "type": "key", "key": "cmd+space" } },
        { "label": "Mission Control", "icon": "rectangle.3.group", "action": { "type": "key", "key": "ctrl+up" } },
        { "label": "Screenshot",      "icon": "camera.viewfinder", "action": { "type": "key", "key": "cmd+shift+4" } },
        { "label": "Apps",            "icon": "square.grid.2x2",   "action": { "type": "menu", "name": "apps" } },
        { "label": "Edit",            "icon": "pencil",            "action": { "type": "menu", "name": "edit" } }
      ]
    },
    "edit": {
      "color": "#ffb020",
      "items": [
        { "label": "Undo",       "icon": "arrow.uturn.backward", "action": { "type": "key", "key": "cmd+z" } },
        { "label": "Redo",       "icon": "arrow.uturn.forward",  "action": { "type": "key", "key": "cmd+shift+z" } },
        { "label": "Cut",        "icon": "scissors",             "action": { "type": "key", "key": "cmd+x" } },
        { "label": "Copy",       "icon": "doc.on.doc",           "action": { "type": "key", "key": "cmd+c" } },
        { "label": "Paste",      "icon": "doc.on.clipboard",     "action": { "type": "key", "key": "cmd+v" } },
        { "label": "Select All", "icon": "selection.pin.in.out", "action": { "type": "key", "key": "cmd+a" } }
      ]
    },
    "apps": {
      "color": "#30c0ff",
      "items": [
        { "label": "Finder",   "icon": "folder",    "action": { "type": "open", "app": "Finder" } },
        { "label": "Safari",   "icon": "safari",    "action": { "type": "open", "app": "Safari" } },
        { "label": "Terminal", "icon": "terminal",  "action": { "type": "open", "app": "Terminal" } },
        { "label": "Settings", "icon": "gearshape", "action": { "type": "open", "app": "System Settings" } }
      ]
    }
  },
  "layers": {
    "base": {
      "light": "#2050ff",
      "leftStick": "mouse",
      "rightStick": "scroll",
      "buttons": {
        "south":     { "type": "mouse", "button": "left" },
        "east":      { "type": "mouse", "button": "right" },
        "west":      { "type": "key", "key": "backspace", "repeat": true },
        "north":     { "type": "key", "key": "enter" },
        "l1":        { "type": "layer", "name": "nav", "mode": "hold" },
        "r1":        { "type": "precision", "factor": 0.3 },
        "l2":        { "type": "key", "key": "cmd" },
        "r2":        { "type": "voice", "key": "f5" },
        "l3":        { "type": "mouse", "button": "left", "clicks": 2 },
        "r3":        { "type": "mouse", "button": "middle" },
        "dpadUp":    { "type": "key", "key": "up", "repeat": true },
        "dpadDown":  { "type": "key", "key": "down", "repeat": true },
        "dpadLeft":  { "type": "key", "key": "left", "repeat": true },
        "dpadRight": { "type": "key", "key": "right", "repeat": true },
        "menu":      { "type": "key", "key": "tab" },
        "view":      { "type": "key", "key": "escape" },
        "touchpadLeft":  { "type": "menu", "name": "main" },
        "touchpadRight": { "type": "menu", "name": "apps" },
        "swipeLeft":     { "type": "key", "key": "cmd+[" },
        "swipeRight":    { "type": "key", "key": "cmd+]" },
        "swipeUp":       { "type": "key", "key": "ctrl+up" },
        "swipeDown":     { "type": "key", "key": "ctrl+down" }
      }
    },
    "nav": {
      "fallback": "base",
      "light": "#00c060",
      "leftStick": "arrows",
      "buttons": {
        "south":     { "type": "key", "key": "cmd+tab" },
        "east":      { "type": "key", "key": "cmd+w" },
        "west":      { "type": "key", "key": "cmd+c" },
        "north":     { "type": "key", "key": "cmd+v" },
        "r1":        { "type": "key", "key": "shift" },
        "l2":        { "type": "key", "key": "cmd+-", "repeat": true },
        "r2":        { "type": "key", "key": "cmd+=", "repeat": true },
        "dpadUp":    { "type": "key", "key": "pageup", "repeat": true },
        "dpadDown":  { "type": "key", "key": "pagedown", "repeat": true },
        "dpadLeft":  { "type": "key", "key": "cmd+shift+[" },
        "dpadRight": { "type": "key", "key": "cmd+shift+]" },
        "menu":      { "type": "key", "key": "cmd+t" },
        "view":      { "type": "key", "key": "cmd+z" },
        "touchpadLeft": { "type": "key", "key": "cmd+l" }
      }
    }
  }
}
```

# What I want

(Describe what you want here, and paste your current config.json if you have one.)

AIs sometimes invent key or button names. If the file fails to load, HACHACON keeps your previous settings, so nothing breaks. Try the buttons and check the assignments in the Show Mappings… window.