Skip to content

feat: catalog of known apps (bundle ID → default per-pedal key mappings) to pre-fill rules on add #16

Description

@ericfitz

Summary

Maintain a catalog of well-known applications (keyed by bundle ID) with default per-pedal key mappings, so that when a user adds a known app in Settings, Footswitch can pre-populate the likely keystrokes for pedal 1 / 2 / 3 instead of leaving them blank. The user is always free to change the suggested defaults — this just removes guesswork for common apps.

The authoritative list of apps, bundle IDs, and key mappings is maintained in this Google Sheet:
https://docs.google.com/spreadsheets/d/1X3lw61pKETU-l1mG2y4ijKo3qt-JOSduF3AdS0lWHNQ/edit

Motivation

Today, adding an app to the rules table (config.rules, see Sources/FootswitchCore/Models/Rule.swift) gives the user an empty SlotActions that they must fill in by hand. For many well-known apps the "right" keystrokes are known and stable (e.g. mute/unmute, next/previous page/slide). Pre-supplying those defaults saves the user from looking up and entering each combo.

Pedal count is independent of the catalog: a single-switch pedal will only ever fire slot 1, so the slot 2/3 defaults are simply unused. But for apps that have distinct actions (separate mute vs. unmute, next vs. prev, as opposed to a single toggle key) we will already know how to populate slots 2 and 3.

Proposed Approach

  • Add a bundled, read-only catalog of { bundleID, appName, slots: { 1, 2, 3 } } entries derived from the Google Sheet (e.g. a JSON resource shipped in the app bundle, generated/exported from the sheet).
  • When the user adds an app in Settings:
    • If the chosen app's bundle ID matches a catalog entry, pre-fill the per-slot actions from the catalog as the new rule's defaults.
    • If there is no match, behave as today (empty slots).
  • Pre-filled values are editable — the catalog only seeds initial defaults; it never overrides a user's saved choice.
  • Catalog entries should map cleanly onto the existing Action model (keyCombo for the common case; the schema should also be able to express slots that have no sensible default).

Open Questions / Decisions

  • Source-of-truth workflow: how do we go from the Google Sheet to the bundled resource? Manual export + commit, or a small script that fetches/transforms the sheet into the JSON resource? (Lean toward a committed JSON file regenerated by a script so the build has no network dependency.)
  • Catalog schema: confirm fields per entry (bundle ID, display name, per-slot action incl. modifiers) and how to represent "no default for this slot."
  • Match semantics: exact bundle-ID match only (consistent with RuleResolver), so this stays a pure convenience layer over the existing matching.
  • Conflict on add: if the user adds an app they already have a rule for, do we touch existing slots? (Proposed: never overwrite existing user values; only seed brand-new rules.)

Acceptance Criteria

  • A bundled catalog of known apps (bundle ID → default per-slot key mappings) exists, sourced from the Google Sheet.
  • Adding a known app in Settings pre-fills pedal 1/2/3 defaults from the catalog.
  • Adding an unknown app behaves exactly as today (no defaults).
  • Pre-filled defaults are fully editable and never override a user's saved configuration.
  • A documented, repeatable process exists for regenerating the catalog from the Google Sheet.

Relevant Code

  • Sources/FootswitchCore/Models/Rule.swiftRule { match, appName, slots }
  • Sources/FootswitchCore/Models/SlotActions.swift — per-slot Action map
  • Sources/FootswitchCore/Models/Action.swiftkeyCombo / dictation / shortcut
  • Sources/FootswitchCore/RuleResolver.swift — exact bundle-ID matching
  • Sources/Footswitch/SettingsView.swift — where apps are added to the rules table

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions