1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2024-12-27 05:28:37 -06:00
random/bluetooth-toggle

13 lines
359 B
Text
Raw Normal View History

2022-01-02 22:35:07 -06:00
#!/bin/sh
2021-04-19 13:54:49 -05:00
# Toggles bluetooth on a Linux system. Make sure that you have bluetoothctl installed.
# I use it with a shortcut.
2021-12-03 20:10:59 -06:00
if [ $(bluetoothctl show | grep Powered | grep -c yes) -eq 1 ]; then
2021-04-19 13:54:49 -05:00
bluetoothctl power off
else
2021-12-08 19:35:57 -06:00
if [ $(rfkill --output-all | grep bluetooth | grep -c blocked) -ne 0 ]; then
rfkill unblock bluetooth
fi
2021-04-19 13:54:49 -05:00
bluetoothctl power on
2021-12-03 20:10:59 -06:00
fi