Skip to content

Instantly share code, notes, and snippets.

@joshpetit
Created July 31, 2020 00:23
Show Gist options
  • Save joshpetit/1395caa532249082a69bca5935d815ec to your computer and use it in GitHub Desktop.
Save joshpetit/1395caa532249082a69bca5935d815ec to your computer and use it in GitHub Desktop.
Script to toggle bluetooth on and off, I add a shortcut in the settings so I can quickly run it.
#!/bin/bash
output=$(bluetoothctl show | sed -n -e 's/^.*Powered: //p')
if [[ $output = no ]]; then
bluetoothctl power on
notify-send -h int:transient:1 "Bluetooth" "On"
else
bluetoothctl power off
notify-send -h int:transient:1 "Bluetooth" "Off"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment