Skip to content

Add sound-switcher extension#27672

Open
corychainsman wants to merge 4 commits intoraycast:mainfrom
corychainsman:ext/sound-switcher
Open

Add sound-switcher extension#27672
corychainsman wants to merge 4 commits intoraycast:mainfrom
corychainsman:ext/sound-switcher

Conversation

@corychainsman
Copy link
Copy Markdown

@corychainsman corychainsman commented May 5, 2026

Description

Adds Sound Switcher, a macOS utility extension for switching default sound devices from Raycast.

The command shows three grouped sections: Unified Devices for matched input/output pairs, Outputs for output-only switching, and Inputs for input-only switching. Current unified/input/output rows are marked with a green check-circle. Device state is cached from the previous run so the list opens quickly, then refreshes asynchronously when the command is invoked. After a successful switch, the Raycast window closes.

This extension bundles the macOS audio helper from @spotxyz/macos-audio-devices, copied into assets/audio-devices by scripts/copy-binary.js. This is the same audio library/helper pattern used by the reviewed Set Audio Device extension.

  • Source: https://github.com/spotxyz/macos-audio-devices
  • License: MIT
  • Binary: universal macOS Mach-O (x86_64 + arm64)
  • User setup: none
  • Usage: list input/output devices, read current defaults, and set default devices by stable backend ID

Validated locally with npm test, npm run lint, and npm run build.

Screencast

Straightforward UI extension; screenshots are included in metadata/:

  • sound-switcher-devices.png
  • sound-switcher-search.png
  • sound-switcher-actions.png

Checklist

- Refine Raycast command metadata
- Bundle macOS audio helper for Raycast extension
- Prepare Raycast extension for Store submission
- Group audio devices into unified, input, and output sections
- Build initial Raycast sound switcher extension
@raycastbot raycastbot added new extension Label for PRs with new extensions platform: macOS labels May 5, 2026
@raycastbot
Copy link
Copy Markdown
Collaborator

Congratulations on your new Raycast extension! 🚀

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days.

Once the PR is approved and merged, the extension will be available on our Store.

@corychainsman corychainsman marked this pull request as ready for review May 5, 2026 17:42
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 5, 2026

Greptile Summary

Adds the Sound Switcher extension, a macOS utility that lists audio devices in three groups (unified pairs, outputs, inputs), caches state across runs for instant display, and refreshes asynchronously on each open. Previously raised issues — singleQuote in .prettierrc, defineConfig usage in eslint.config.js, dependency placement for @spotxyz/macos-audio-devices, icon differentiation on action panels, and error handling during background refresh — are all addressed in the current code.

  • src/audio.ts wraps the bundled audio-devices binary with typed error classes, injectable runner (enabling unit tests), and rollback logic when a paired switch partially fails.
  • src/index.tsx implements cache-then-refresh loading with preserved ready state on background errors, plus optimistic state updates after a successful switch.
  • scripts/copy-binary.js copies the native binary from devDependencies into assets/ at build time, with platform and existence guards.

Confidence Score: 5/5

Safe to merge — new extension with no changes to existing code, well-structured error handling, and comprehensive unit tests.

This is a greenfield extension. The core logic is well-covered by tests (normalization, virtual-device filtering, pair building, rollback), error paths preserve the cached device list rather than resetting to a blank screen, and all previously flagged issues have been addressed. No regressions are possible to existing extensions.

No files require special attention.

Important Files Changed

Filename Overview
extensions/sound-switcher/src/audio.ts Core audio logic: binary invocation, device parsing, state building, and pair switching with rollback. Well-structured with clear error types and injectable runner for testing.
extensions/sound-switcher/src/index.tsx Main Raycast command: cache-then-refresh loading, three-section device list, optimistic state updates after switching, and error recovery that preserves cached ready state.
extensions/sound-switcher/package.json Correct schema, category, platform, and dependency placement — @spotxyz/macos-audio-devices is in devDependencies as a build-time-only tool.
extensions/sound-switcher/scripts/copy-binary.js Build-time helper that copies the macOS audio binary from node_modules into assets/; properly guards for non-macOS platforms and missing source.
extensions/sound-switcher/test/audio.test.ts Good unit coverage: normalization, virtual-device filtering, pair building, current-device marking, and rollback on switch failure.

Reviews (4): Last reviewed commit: "Preserve cached devices on refresh failu..." | Re-trigger Greptile

Comment thread extensions/sound-switcher/.prettierrc
Comment thread extensions/sound-switcher/eslint.config.js Outdated
Comment thread extensions/sound-switcher/package.json
Comment thread extensions/sound-switcher/src/index.tsx Outdated
@corychainsman corychainsman marked this pull request as draft May 5, 2026 18:19
@corychainsman corychainsman marked this pull request as ready for review May 5, 2026 18:44
Comment thread extensions/sound-switcher/src/index.tsx
@corychainsman corychainsman marked this pull request as draft May 5, 2026 19:15
@corychainsman corychainsman marked this pull request as ready for review May 5, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new extension Label for PRs with new extensions platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants