Disable Bluetooth by default to prevent BlueZ connection popup on Linux startup#322212
Open
ayu-haker wants to merge 2 commits into
Open
Disable Bluetooth by default to prevent BlueZ connection popup on Linux startup#322212ayu-haker wants to merge 2 commits into
ayu-haker wants to merge 2 commits into
Conversation
Electron initiates a connection to BlueZ (Linux Bluetooth daemon) on startup, causing a Bluetooth permission popup for users who don't even use Bluetooth. Disable Bluetooth by default using Chromium's --disable-bluetooth switch. Users who need Web Bluetooth can opt-in with --enable-bluetooth CLI flag. Fixes microsoft#134461
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Electron main entrypoint (src/main.ts) to prevent VS Code from triggering a BlueZ (Linux Bluetooth daemon) connection attempt during startup by appending Chromium’s --disable-bluetooth switch early in initialization, with an opt-in escape hatch.
Changes:
- Append
--disable-bluetoothduring early command-line switch configuration to avoid BlueZ activation on startup. - Provide an opt-in path via
--enable-bluetooth(so the disable switch is not appended).
Comment on lines
+370
to
+372
| if (!app.commandLine.hasSwitch('enable-bluetooth')) { | ||
| app.commandLine.appendSwitch('disable-bluetooth'); | ||
| } |
dfe1fb2 to
ae4e4f2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On Linux, VS Code requests Bluetooth access on startup because Electron initiates a connection to BlueZ (Linux Bluetooth daemon) early in the startup process. This causes a distracting system permission popup for users who don't even use Bluetooth.
Fix
Add
--disable-bluetoothChromium switch early in the startup sequence to prevent Electron from connecting to BlueZ.Users who need Web Bluetooth functionality can opt in by passing
--enable-bluetoothCLI flag.Changes
src/main.ts: Addeddisable-bluetoothswitch beforeargvConfigreturn, with--enable-bluetoothopt-inRelated
Fixes #134461