diff --git a/app/composables/useElectron.ts b/app/composables/useElectron.ts index 73eb2cb..aa67f7d 100644 --- a/app/composables/useElectron.ts +++ b/app/composables/useElectron.ts @@ -36,6 +36,7 @@ interface HeliumElectronAPI { venmicLink: (options: VenmicLinkOptions) => Promise; venmicUnlink: () => Promise; checkScreenPermission: () => Promise; + openScreenPermissionSettings: () => Promise; } declare global { @@ -212,6 +213,28 @@ export function useElectron() { return platformInfo.value.supportsLoopbackAudio || platformInfo.value.supportsVenmic; }); + const getScreenPermissionStatus = async (): Promise => { + if (!checkElectron()) return "granted"; + + try { + return await window.heliumElectron!.checkScreenPermission(); + } catch (error) { + console.error("[useElectron] Failed to check screen permission:", error); + return "unknown"; + } + }; + + const openScreenPermissionSettings = async (): Promise => { + if (!checkElectron()) return false; + + try { + return await window.heliumElectron!.openScreenPermissionSettings(); + } catch (error) { + console.error("[useElectron] Failed to open screen permission settings:", error); + return false; + } + }; + onMounted(() => { checkElectron(); if (isElectron.value) { @@ -246,9 +269,10 @@ export function useElectron() { linkAllAudio, linkAppAudio, unlinkVenmicAudio, + getScreenPermissionStatus, + openScreenPermissionSettings, startScreenShareWithAudio, stopScreenShare, }; } - diff --git a/app/pages/stream.vue b/app/pages/stream.vue index 45a25a2..37b5be0 100644 --- a/app/pages/stream.vue +++ b/app/pages/stream.vue @@ -56,6 +56,7 @@