Skip to content

Instantly share code, notes, and snippets.

@polaroidkidd
Created November 3, 2020 22:10
Show Gist options
  • Save polaroidkidd/39bdd0c2041b0b9cc69d0be7d88590f2 to your computer and use it in GitHub Desktop.
Save polaroidkidd/39bdd0c2041b0b9cc69d0be7d88590f2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
BLUETOOTH_STATE=$(dbus-send --session --dest=org.blueman.Applet --print-reply=literal /org/blueman/applet org.blueman.Applet.GetBluetoothStatus | sed "s/^[[:space:]].*boolean //g")
if [ "${BLUETOOTH_STATE}" == "true" ]; then
dbus-send --session --dest=org.blueman.Applet --print-reply /org/blueman/applet org.blueman.Applet.SetBluetoothStatus boolean:false
else
dbus-send --session --dest=org.blueman.Applet --print-reply /org/blueman/applet org.blueman.Applet.SetBluetoothStatus boolean:true
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment