Skip to content

Instantly share code, notes, and snippets.

@Sy3Omda
Created September 19, 2022 06:55
Show Gist options
  • Save Sy3Omda/0d1c33e520071f0e37c4435f6a80326f to your computer and use it in GitHub Desktop.
Save Sy3Omda/0d1c33e520071f0e37c4435f6a80326f to your computer and use it in GitHub Desktop.
Fix bluetooth auto connect device and auto set speaker output
#!/usr/bin/env bash
# This to fix some issue realted to bluetooth auto connect avialable devices and auto set speaker to that device
# bluetoothctl devices # To get MAC of bluetooth devices.
echo "connect 00:00:00:00:00:00" | bluetoothctl >/dev/null # then Auto connect bluetooth
# you can put this in bash script and make cron job OR simply add it in bashrc || zshrc file to execute every start of terminal
# Then set default speaker to bluetooth simply run as sudo
sudo tee /etc/pulse/default.pa << EOF > /dev/null
.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
load-module module-switch-on-connect # Add this
.endif
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment