Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Update event names with the format `cap://(category)/(action)`

Ilya0e5644d013a0
diff --git a/apps/desktop/src/components/windows/Camera.tsx b/apps/desktop/src/components/windows/Camera.tsx
index 5f6379700..5a67d0f79 100644
--- a/apps/desktop/src/components/windows/Camera.tsx
+++ b/apps/desktop/src/components/windows/Camera.tsx
@@ -120,7 +120,7 @@ export const Camera = () => {
tauriWindowImport.then(async ({ getCurrentWindow }) => {
if (emitSetDevice) {
- await emit("change-device", {
+ await emit("cap://av/set-device", {
type: "videoinput",
device: null,
});
@@ -181,7 +181,7 @@ export const Camera = () => {
};
const select = async (device: Device | null) => {
- emit("change-device", { type: "videoinput", device: device }).catch(
+ emit("cap://av/set-device", { type: "videoinput", device: device }).catch(
(error) => console.log("Failed to emit change-device event:", error)
);
};
diff --git a/apps/desktop/src/components/windows/inner/Recorder.tsx b/apps/desktop/src/components/windows/inner/Recorder.tsx
index 59ec14898..ee6a0f2fd 100644
--- a/apps/desktop/src/components/windows/inner/Recorder.tsx
+++ b/apps/desktop/src/components/windows/inner/Recorder.tsx
@@ -70,8 +70,8 @@ export const Recorder = () => {
}, [proCheckPromise]);
const selectDevice = (kind: DeviceKind, device: Device | null) =>
- emit("change-device", { type: kind, device: device }).catch((error) =>
- console.log("Failed to emit change-device event:", error)
+ emit("cap://av/set-device", { type: kind, device: device }).catch((error) =>
+ console.log("Failed to emit cap://av/set-device event:", error)
);
const createDeviceMenuOptions = (kind: DeviceKind) => [
diff --git a/apps/desktop/src/utils/recording/MediaDeviceContext.tsx b/apps/desktop/src/utils/recording/MediaDeviceContext.tsx
index 057254023..0fd4d9dd0 100644
--- a/apps/desktop/src/utils/recording/MediaDeviceContext.tsx
+++ b/apps/desktop/src/utils/recording/MediaDeviceContext.tsx
@@ -163,7 +163,7 @@ export const MediaDeviceProvider: React.FC<React.PropsWithChildren<{}>> = ({
unlistenFnChangeDevice = await listen<{
type: string;
device: Device | null;
- }>("change-device", (event) => {
+ }>("cap://av/set-device", (event) => {
updateSelectedDevice(
event.payload.type as DeviceKind,
event.payload.device
diff --git a/apps/desktop/src/utils/tray.ts b/apps/desktop/src/utils/tray.ts
index 3127eed36..5a44cb5c7 100644
--- a/apps/desktop/src/utils/tray.ts
+++ b/apps/desktop/src/utils/tray.ts
@@ -101,6 +101,6 @@ export const setTrayStopIcon = async (showStopIcon: boolean) => {
};
const selectDevice = (kind: DeviceKind, device: Device | null) =>
- emit("change-device", { type: kind, device: device }).catch((error) =>
- console.log("Failed to emit change-device event:", error)
+ emit("cap://av/set-device", { type: kind, device: device }).catch((error) =>
+ console.log("Failed to emit cap://av/set-device event:", error)
);