Created
September 30, 2025 00:28
-
-
Save teklynk/bc6234daf9a10ade13f75cc9522b1064 to your computer and use it in GitHub Desktop.
A Simple Bash Script to Toggle Bluetooth on and off - Linux Mint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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