Skip to content

feat(macos): Added asynchronous microphone permisson request#187

Draft
Lynden-Sylvester wants to merge 1 commit intostoatchat:mainfrom
Lynden-Sylvester:feat/macos-request-microphone-permission
Draft

feat(macos): Added asynchronous microphone permisson request#187
Lynden-Sylvester wants to merge 1 commit intostoatchat:mainfrom
Lynden-Sylvester:feat/macos-request-microphone-permission

Conversation

@Lynden-Sylvester
Copy link
Copy Markdown

This feature addition addresses this issue stated here: #102, and removes the need for the manual fix #102 (comment) by handling it in the code itself, baking the process so future users don't have to manually add the permission request in their Terminal.

Changes Made

forge.config.ts - Added Microphone usage description to packagerConfig:

extendInfo: {
    NSMicrophoneUsageDescription:
        "Stoat needs access to the microphone to enable voice chat features.",
},

src/main.ts - Updated imports and ready handler:

  • Added systemPreferences to Electron imports
  • Changed app.on("ready", () => {} toapp.on("ready", async () => {}
  • Added await systemPreferences.askForMediaAccess("microphone"); with error handling

Testing

  • Built locally on macOS and verified the permission dialog appears on first launch
  • Live-tested voice call functionality with another user; audio was transmitted clearly with a headset mic
  • Confirmed console logs show grant status

Signed-off-by: Lynden-Sylvester <78802283+Lynden-Sylvester@users.noreply.github.com>
Comment on lines +46 to +53
// -- macOS Microphone Permission --
try {
const granted = await systemPreferences.askForMediaAccess("microphone");
console.log("Microphone access granted:", granted);
} catch (error) {
console.error("Error requesting microphone access:", error);
}
// -----------------------------------
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not on the frontend team but this should certainly not be happening on app startup. Permissions should only be requested as-needed, eg when the user attempts to join a voice chat.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.

I wasn't super sure which repo it belonged to because it is a desktop-specific feature for macOS, but the for-desktop repo is just a wrapper of the for-web repo where the voice rooms are, and it's not clear what the entry point is that triggers the process of joining a room, as that should trigger a check to see if Stoat has the microphone permission granted, and if not, to trigger the call to the System Preferences to request that permission and await the response to receive granted or denied status. And have the Key-pair for the permission added to the plist, which to my understanding is generated by forge here in the for-desktop repo.

I'd love to implement the feature in the way that best works with the codebase, and if someone from the frontend team can point me in the right direction, that'd be great! As from a contributor's perspective, it looks like one part needs to be added in one repo and the other part in another. So it's a little confusing.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching this to a draft, and will wait for someone from the frontend team to let me know the the right repository and file to look at to move the permission addition to.

@Lynden-Sylvester Lynden-Sylvester marked this pull request as draft March 10, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Mac OS app does not receive audio input

2 participants