diff --git a/i3blocks/bluetooth.sh b/i3blocks/bluetooth.sh new file mode 100755 index 0000000..5bbf680 --- /dev/null +++ b/i3blocks/bluetooth.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Get Bluetooth device info +bluetooth_info=$(bluetoothctl info) + +# Check if Bluetooth is connected +if echo "$bluetooth_info" | grep -q "Connected: yes"; then + device=$(echo "$bluetooth_info" | grep "Alias" | cut -d ' ' -f2-) + echo " $device" #  is the Bluetooth icon + echo + echo "#50FA7B" # Green for connected +else + echo " Disconnected" + echo + echo "#FF5555" # Red for disconnected +fi + diff --git a/i3blocks/config b/i3blocks/config index 314d5a1..82b3c8f 100644 --- a/i3blocks/config +++ b/i3blocks/config @@ -22,6 +22,15 @@ command=df -h / | awk '/\// {print " Disk: " $3 "/" $2}' #  for disk interval=30 color=#50FA7B +[volume] +command=~/.config/i3blocks/volume.sh +interval=1 + +[bluetooth] +command=~/.config/i3blocks/bluetooth.sh +interval=5 + + [ethernet] command=ip -o -4 addr show enp6s0 | awk '{print " LAN: "$4}' || echo " LAN: down" #  for Ethernet interval=10 diff --git a/i3blocks/volume.sh b/i3blocks/volume.sh new file mode 100755 index 0000000..8397bb4 --- /dev/null +++ b/i3blocks/volume.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Get the current volume level and mute status +volume=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | tr -d '%') +mute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') + +# Determine icon and color based on mute status +if [ "$mute" = "yes" ]; then + icon="🔇" # Muted + color="#FF5555" # Red +else + icon="🔊" # Volume icon + color="#50FA7B" # Green +fi + +# Output the volume with icon and color +echo "$icon $volume%" +echo +echo $color +