Skip to content

Add a config.toml option for which terminal Cmd+; spawns jcode into (currently only undocumented preferred_terminal.json) #401

Closed

Description

@bmtlima

Summary

The terminal that the system-wide Cmd+; hotkey (and in-app spawns) launch jcode into is only configurable via a separate, undocumented ~/.jcode/preferred_terminal.json file. There is no corresponding key in ~/.jcode/config.toml, so it is not discoverable.

Current behavior

  • The preference is stored in ~/.jcode/preferred_terminal.json, e.g. {"terminal":"terminal"} (Apple Terminal) or {"terminal":"ghostty"}.
  • ~/.jcode/hotkey/launch_jcode.sh is generated from that preference by jcode setup-hotkey.
  • The [terminal] section in config.toml only documents spawn_hook and focus_hook; there is no [terminal] preferred = "ghostty" (or similar) key.
  • Changing preferred_terminal.json alone does not rewrite the already-installed launch_jcode.sh; you must re-run jcode setup-hotkey for the launcher to pick it up. This is an easy footgun (editing the JSON looks like it should be sufficient).

Repro

  1. On macOS, set up the hotkey while Apple Terminal is the preferred terminal.
  2. Later install/prefer Ghostty and edit ~/.jcode/preferred_terminal.json to {"terminal":"ghostty"}.
  3. Press Cmd+; -> it still spawns in Apple Terminal, because launch_jcode.sh was not regenerated.

Proposed fix

  1. Add a first-class, documented config key, e.g.:
    [terminal]
    # Terminal used by the Cmd+; launch hotkey and in-app spawns on macOS.
    # One of: ghostty, iterm2, wezterm, alacritty, kitty, terminal
    preferred = "ghostty"
    Keep preferred_terminal.json working for back-compat, but treat the config.toml key as the source of truth (or at least document the JSON file).
  2. When the preference changes (via config, /config, or the onboarding terminal picker), automatically regenerate ~/.jcode/hotkey/launch_jcode.sh so the launcher stays in sync without a manual jcode setup-hotkey re-run.
  3. Mention the setting in the generated default config.toml comments next to the existing [terminal] spawn_hook/focus_hook docs and near the new_terminal keybinding.

Environment

  • jcode v0.31.2 (446be1d)
  • macOS (aarch64)

Activity

  1. added
    enhancement
    priority: low
    autonomous: likely
    on Jun 24, 2026
  2. 1jehuang commented on Jun 24, 2026

    @1jehuang
    Owner

    Triage confirmed: TerminalConfig (crates/jcode-config-types/src/lib.rs:600) only exposes spawn_hook/focus_hook — no preferred key. The preferred terminal lives solely in ~/.jcode/preferred_terminal.json (crates/jcode-setup-hints/src/macos_terminal.rs:81, load/save at :84/:90), and run_setup_hotkey regenerates launch_jcode.sh from it (lib.rs:307/333). Editing the JSON without re-running setup-hotkey is indeed a footgun. The proposed [terminal] preferred key + auto-regenerate-on-change is a clean, well-scoped enhancement. Autonomous: likely.

  3. added
    triage: reproducible
    on Jun 25, 2026
  4. 1jehuang commented on Jun 25, 2026

    @1jehuang
    Owner

    Triage: reproducible. Verified: TerminalConfig (crates/jcode-config-types/src/lib.rs) only exposes spawn_hook/focus_hook — no preferred key. The preferred terminal lives solely in ~/.jcode/preferred_terminal.json (crates/jcode-setup-hints/src/macos_terminal.rs:81), and launch_jcode.sh is only regenerated when setup-hotkey runs, so editing the JSON alone is the described footgun. The proposed [terminal] preferred config key + auto-regenerate-on-change is well-scoped. Keeping existing autonomous: likely / priority: low.

  5. 1jehuang commented on Jun 29, 2026

    @1jehuang
    Owner

    Fix in #417: added a discoverable, documented [terminal] preferred key in config.toml, preferred over the legacy ~/.jcode/preferred_terminal.json in effective_macos_terminal() (config > JSON > detection), and documented it in the generated default config. Auto-regenerate-of-launch_jcode.sh-on-change is left as a follow-up; jcode setup-hotkey still regenerates it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    autonomous: likelyenhancementpriority: lowtriage: reproducible

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions