fix(studio): enable microphone/camera access in Linux WebKitGTK webview by rsd-darshan · Pull Request #8720 · unslothai/unsloth · GitHub
Skip to content

fix(studio): enable microphone/camera access in Linux WebKitGTK webview - #8720

Merged
shimmyshimmer merged 1 commit into
unslothai:mainfrom
rsd-darshan:fix/studio-linux-mic-permission
Aug 17, 2026
Merged

fix(studio): enable microphone/camera access in Linux WebKitGTK webview#8720
shimmyshimmer merged 1 commit into
unslothai:mainfrom
rsd-darshan:fix/studio-linux-mic-permission

Conversation

@rsd-darshan

Copy link
Copy Markdown
Contributor

Summary

Fixes #8678. On Linux, Unsloth Desktop cannot access the microphone for voice dictation: WebKitGTK ships two defaults that together block it, and neither can be worked around from outside the embedding application.

  • enable-media-stream is off by default on WebKitSettings.
  • The stock permission-request handler denies every request that has no listener override, including UserMediaPermissionRequest.

Fix

Added setup_linux_media_permissions, called from the existing Linux setup path alongside setup_custom_titlebar:

  • Enables enable-media-stream on the main window's webview settings.
  • Connects to the permission-request signal and auto-allows only UserMediaPermissionRequest (mic/camera). Every other permission kind (notifications, geolocation, etc.) keeps WebKitGTK's default deny.

webkit2gtk (the safe bindings crate, distinct from the already-present webkit2gtk-sys) is added as a direct Linux dependency, pinned to 2.0.2 — the exact version already resolved transitively via wry, so Cargo.lock only gains one dependency edge with no version changes.

Testing

  • cargo check / cargo clippy / cargo fmt --check all pass cleanly on a real Linux build (Debian bookworm, with libwebkit2gtk-4.1-dev/libgtk-3-dev installed) — the platform-gated code doesn't compile at all on macOS/Windows hosts, so this was verified in a Linux container rather than locally.
  • No new clippy warnings or formatting diffs introduced; the only pre-existing warnings are unrelated to this change.

Have not been able to test on real hardware with a microphone — happy to have the reporter (or anyone else) confirm the fix once a build is available, per their offer on the issue.

WebKitGTK ships two defaults that together block voice dictation on
Ubuntu/Linux builds: enable-media-stream is off, and the stock
permission-request handler denies every request that has no listener
override, including UserMediaPermissionRequest. Neither can be fixed
from outside the embedding application, so opt in from the Tauri
setup hook: enable enable-media-stream on the webview settings and
auto-allow only user-media permission requests, leaving every other
permission kind on WebKitGTK's default deny.
@rsd-darshan

rsd-darshan commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

@rsd-darshan

Copy link
Copy Markdown
Contributor Author

Update from the issue: the earlier devtools-only report was a stale-build testing artifact, not a real gap. Re-tested with a clean `cargo build --release` (no extra features) — mic works end-to-end, confirmed via the permission-request → UserMediaPermissionRequest → allow flow firing and a successful transcription API call in the running app. `WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS=1` made no difference, ruling out the sandbox/portal theory I'd raised as a precaution. Full thread: #8678 (comment)

This is now field-verified on real hardware (Arch/Garuda, GNOME/Wayland, Intel Arc B580) in addition to the CI build check.

@shimmyshimmer

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

@shimmyshimmer
shimmyshimmer merged commit 5991194 into unslothai:main Aug 17, 2026
31 of 41 checks passed
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] Ubuntu Mate: Microphone / getUserMedia fails on Unsloth Desktop (using the .deb) -> WebKitGTK media-stream not enabled?

2 participants