diff --git a/extensions/audio-device/CHANGELOG.md b/extensions/audio-device/CHANGELOG.md
index 8965e8ca3bb..e29032245cf 100644
--- a/extensions/audio-device/CHANGELOG.md
+++ b/extensions/audio-device/CHANGELOG.md
@@ -1,5 +1,9 @@
# Audio Device Changelog
+## [Update] - 2025-06-26
+
+- Added support for device name for quick links
+
## [Update] - 2025-06-11
- Added combo commands to simultaneously change input and output device
diff --git a/extensions/audio-device/src/helpers.tsx b/extensions/audio-device/src/helpers.tsx
index eb7a609d1c5..cf0e87b354b 100644
--- a/extensions/audio-device/src/helpers.tsx
+++ b/extensions/audio-device/src/helpers.tsx
@@ -31,9 +31,10 @@ import { usePromise } from "@raycast/utils";
type DeviceListProps = {
type: "input" | "output";
deviceId?: string;
+ deviceName?: string;
};
-export function DeviceList({ type, deviceId }: DeviceListProps) {
+export function DeviceList({ type, deviceId, deviceName }: DeviceListProps) {
const { isLoading, data } = useAudioDevices(type);
const { data: hiddenDevices, revalidate: refetchHiddenDevices } = usePromise(getHiddenDevices, []);
const { data: showHidden, revalidate: refetchShowHidden } = usePromise(async () => {
@@ -41,10 +42,15 @@ export function DeviceList({ type, deviceId }: DeviceListProps) {
}, []);
useEffect(() => {
- if (!deviceId || !data?.devices) return;
- const device = data.devices.find((d) => d.id === deviceId);
+ if ((!deviceId && !deviceName) || !data?.devices) return;
+
+ let device = null;
+ if (deviceId) device = data.devices.find((d) => d.id === deviceId);
+ if (!device && deviceName) device = data.devices.find((d) => d.name === deviceName);
+
if (!device) {
- showToast(Toast.Style.Failure, "Error!", `The device with id ${deviceId} was not found.`);
+ const searchCriteria = deviceId ? `id ${deviceId}` : `name "${deviceName}"`;
+ showToast(Toast.Style.Failure, "Error!", `The device with ${searchCriteria} was not found.`);
return;
}
@@ -63,7 +69,7 @@ export function DeviceList({ type, deviceId }: DeviceListProps) {
);
}
})();
- }, [deviceId, data, type]);
+ }, [deviceId, deviceName, data, type]);
const DeviceActions = ({ device }: { device: AudioDevice }) => (
<>
@@ -73,6 +79,7 @@ export function DeviceList({ type, deviceId }: DeviceListProps) {
name: `Set ${device.isOutput ? "Output" : "Input"} Device to ${device.name}`,
link: createDeepLink(device.isOutput ? "set-output-device" : "set-input-device", {
deviceId: device.id,
+ deviceName: device.name,
}),
}}
/>
diff --git a/extensions/audio-device/src/set-input-device.tsx b/extensions/audio-device/src/set-input-device.tsx
index 4ddcc88a646..7729b311303 100644
--- a/extensions/audio-device/src/set-input-device.tsx
+++ b/extensions/audio-device/src/set-input-device.tsx
@@ -3,9 +3,10 @@ import { DeviceList } from "./helpers";
interface Props {
launchContext?: {
deviceId?: string;
+ deviceName?: string;
};
}
export default function Command({ launchContext }: Props) {
- return ;
+ return ;
}
diff --git a/extensions/audio-device/src/set-output-device.tsx b/extensions/audio-device/src/set-output-device.tsx
index 958d827e14d..32209b054b9 100644
--- a/extensions/audio-device/src/set-output-device.tsx
+++ b/extensions/audio-device/src/set-output-device.tsx
@@ -4,10 +4,15 @@ import { AirPlaySelector } from "./airplay";
interface Context {
deviceId?: string;
+ deviceName?: string;
}
export default function Command({ launchContext }: { launchContext?: Context }) {
const preferences = getPreferenceValues();
- return preferences.airplay ? : ;
+ return preferences.airplay ? (
+
+ ) : (
+
+ );
}