Set up Bluetooth toggling via keyboard shortcut

Based on this Gist

It didn’t work on Linux Mint, but this variant did


IS_BLUETOOTH_ON=$(dbus-send --system --dest=org.bluez --print-reply /org/bluez/hci0 org.freedesktop.DBus.Properties.Get string:org.bluez.Adapter1 string:Powered )

    rfkill unblock 0
    rfkill block 0

exit 0

I saved this to a file (in my case in ~/code/scripts/ ) and made it executable with chmod +x ~/code/scripts/ . Then I assigned this to run via a keyboard shortcut using the GUI keyboard management tool