From 8057d6ca46b4e531ea7e0d2a47b45d3baa9506b4 Mon Sep 17 00:00:00 2001 From: Filippo Ferrari Date: Fri, 9 Feb 2024 18:04:12 +0100 Subject: [PATCH] feat: sb-bluetooth script added --- .local/bin/statusbar/sb-bluetooth | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 .local/bin/statusbar/sb-bluetooth diff --git a/.local/bin/statusbar/sb-bluetooth b/.local/bin/statusbar/sb-bluetooth new file mode 100755 index 0000000..9ab6ebd --- /dev/null +++ b/.local/bin/statusbar/sb-bluetooth @@ -0,0 +1,21 @@ +#!/bin/bash + + # Check the status of the Bluetooth + bluetooth_status=$(bluetoothctl show | awk '/Powered/ {print $2}') + connected_devices=$(bluetoothctl info | grep -iE 'Connected: yes') + + # Set the icon based on Bluetooth status + if [ "$bluetooth_status" == "yes" ] && [ ! -z "$connected_devices" ]; then + # Bluetooth is on and connected to a device + icon=" " + elif [ "$bluetooth_status" == "yes" ]; then + # Bluetooth is on but not connected to a device + icon="" + else + # Bluetooth is off + icon="❌" + fi + + # Print the icon + echo "$icon" +