Skip to content

feat: per-peripheral type icons with detection and manual picker - #48

Merged
MegaManSec merged 1 commit into
mainfrom
feat/peripheral-type-icons
Jun 7, 2026
Merged

feat: per-peripheral type icons with detection and manual picker#48
MegaManSec merged 1 commit into
mainfrom
feat/peripheral-type-icons

Conversation

@MegaManSec

Copy link
Copy Markdown
Owner

Summary

Each peripheral now shows a type-specific icon instead of the single shared keyboard glyph, in both the menu-bar dropdown and the Peripheral settings tab. The displayed type is the user's manual override if set, otherwise auto-detected.

Changes

  • PeripheralType — new enum (keyboard / mouse / trackpad / headphones / airpods / microphone / unknown) with availability-resolving SF Symbols (falls back to older glyphs on older macOS) and detect(name:classOfDevice:).
  • Auto-detection — combines the Bluetooth Class of Device (best for audio gear, whose names rarely say "headphones") with the device name (AirPods vs any headset; mouse vs trackpad, both of which report as a generic pointing device).
  • Manual picker — in Settings, each row's icon is a menu: Automatic (clears the override), the six types, and Other. Works in both Registered and Available sections; the override is keyed by address, so it carries over when an Available peripheral is added.
  • Store — persisted local typeOverrides map + a deviceClasses cache populated from the live paired-device snapshot; peripheralType(for:) / setTypeOverride(_:for:).
  • Name-refresh fix — registered names now reconcile against the live paired list, so renaming a device in System Settings -> Bluetooth propagates to the list, dropdown, and Settings. The Peripheral tab polls while visible, and the dropdown fetches on open.
  • Dropdown interaction — rows act on mouse-up (released inside the row) instead of mouse-down; dragging off cancels.

Notes

  • The type override is local to each Mac (not synced over the wire) — consistent with how peripheral metadata is handled today; the peer auto-detects its own icons.
  • No new files (project uses explicit file refs) and no wire-protocol changes.

Test plan

  • Dropdown shows correct per-type icons.
  • Settings -> Peripheral: icon menu offers Automatic + 6 types + Other, in both Registered and Available.
  • Rename a device in System Settings -> Bluetooth with the tab open -> updates within ~2s, no tab switch.
  • Dropdown rows act on release, not press; drag-off cancels.

Builds clean and passes swift format lint.

Replace the single shared keyboard glyph with a type-specific icon for
each peripheral, in both the menu-bar dropdown and the Peripheral
settings tab. The shown type is the user's override if set, else
auto-detected from the Bluetooth Class of Device (reliable for audio
gear) plus the device name.

- PeripheralType enum: keyboard/mouse/trackpad/headphones/airpods/
  microphone/unknown, with availability-resolving SF Symbols and
  detect(name:classOfDevice:).
- Store: persisted local typeOverrides map + deviceClasses cache;
  peripheralType(for:) and setTypeOverride(_:for:).
- Settings rows render the icon as a Menu picker (Automatic, the six
  types, and Other) in both Registered and Available sections.
- Live names: reconcile registered names from the live paired list so a
  rename in System Settings -> Bluetooth propagates; poll while the
  Peripheral tab is visible, and fetch when the dropdown opens.
- Dropdown rows act on mouse-up (released inside the row) rather than
  mouse-down.
@MegaManSec
MegaManSec merged commit aa31159 into main Jun 7, 2026
2 checks passed
@MegaManSec
MegaManSec deleted the feat/peripheral-type-icons branch June 7, 2026 23:43
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 2.15.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant