Skip to content

Instantly share code, notes, and snippets.

@teklynk
Created September 30, 2025 00:28
Show Gist options
  • Select an option

  • Save teklynk/bc6234daf9a10ade13f75cc9522b1064 to your computer and use it in GitHub Desktop.

Select an option

Save teklynk/bc6234daf9a10ade13f75cc9522b1064 to your computer and use it in GitHub Desktop.
A Simple Bash Script to Toggle Bluetooth on and off - Linux Mint
#!/bin/bash
# You can bind it to a keyboard shortcut (on Linux Mint: Settings → Keyboard → Shortcuts → Custom Shortcuts). Written for the Cinnamon edition of Linux Mint, it should be easy to adapt to other Linux distributions.
# Check if Bluetooth is on or off
status=$(bluetoothctl show | grep "Powered: yes")
if [ -n "$status" ]; then
# Bluetooth is currently on, so turn it off
echo "Turning Bluetooth off..."
bluetoothctl power off
play /usr/share/mint-artwork/sounds/unplug.oga
notify-send "Bluetooth disabled."
else
# Bluetooth is currently off, so turn it on
echo "Turning Bluetooth on..."
bluetoothctl power on
play /usr/share/mint-artwork/sounds/plug.oga
notify-send "Bluetooth enabled."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment