Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ## Bluetooth toggle
- BTSTATE=$(connmanctl technologies | sed -n -e '/bluetooth/,+5p' | grep Powered | awk '{print $3; exit}')
- # Toggle Bluetooth
- case "$1" in
- "toggle")
- if [ "$BTSTATE" == "False" ] ; then
- echo 0 > /proc/bluetooth/sleep/lpm && dbus-send --system --print-reply --dest=net.connman /net/connman/technology/bluetooth net.connman.Technology.SetProperty string:"Powered" variant:boolean:true
- else
- dbus-send --system --print-reply --dest=net.connman /net/connman/technology/bluetooth net.connman.Technology.SetProperty string:"Powered" variant:boolean:false && echo 1 > /proc/bluetooth/sleep/lpm
- fi
- ;;
- esac
- exit 0
Add Comment
Please, Sign In to add comment