1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2024-12-26 13:18:35 -06:00
random/bluetooth-toggle
2021-12-28 02:54:26 -06:00

13 lines
No EOL
359 B
Text

# Toggles bluetooth on a Linux system. Make sure that you have bluetoothctl installed.
# I use it with a shortcut.
#!/bin/sh
if [ $(bluetoothctl show | grep Powered | grep -c yes) -eq 1 ]; then
bluetoothctl power off
else
if [ $(rfkill --output-all | grep bluetooth | grep -c blocked) -ne 0 ]; then
rfkill unblock bluetooth
fi
bluetoothctl power on
fi