-
-
Save onesixromcom/2a1f4257606d618e9cfbafd8d12f29f4 to your computer and use it in GitHub Desktop.
Reconnect bluetooth headset for current active user (across mltiuser env)
This file contains 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
#!/bin/sh | |
DEVICE_MAC='12:12:12:12:12:12' | |
bluetoothctl power on | |
bluetoothctl disconnect $DEVICE_MAC | |
bluetoothctl remove $DEVICE_MAC | |
bluetoothctl power off | |
bluetoothctl power on | |
sleep 5 | |
bluetoothctl pairable on | |
bluetoothctl agent on | |
bluetoothctl default-agent | |
timeout 6s bluetoothctl scan on | |
# Here is error when turn off scaning. | |
bluetoothctl scan off | |
sudo killall pulseaudio | |
# start pulseaudio server immediatley from current user to make it's with the lowest id | |
systemctl --user start pulseaudio.service | |
bluetoothctl pair $DEVICE_MAC | |
bluetoothctl trust $DEVICE_MAC | |
bluetoothctl connect $DEVICE_MAC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment