mirror of
https://github.com/kuhyx/scripts.git
synced 2026-07-04 15:23:11 +02:00
feat: add volume and bluetooth info
This commit is contained in:
parent
b6a36b2789
commit
1e3e70cfe8
17
i3blocks/bluetooth.sh
Executable file
17
i3blocks/bluetooth.sh
Executable file
@ -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
|
||||||
|
|
||||||
@ -22,6 +22,15 @@ command=df -h / | awk '/\// {print " Disk: " $3 "/" $2}' # for disk
|
|||||||
interval=30
|
interval=30
|
||||||
color=#50FA7B
|
color=#50FA7B
|
||||||
|
|
||||||
|
[volume]
|
||||||
|
command=~/.config/i3blocks/volume.sh
|
||||||
|
interval=1
|
||||||
|
|
||||||
|
[bluetooth]
|
||||||
|
command=~/.config/i3blocks/bluetooth.sh
|
||||||
|
interval=5
|
||||||
|
|
||||||
|
|
||||||
[ethernet]
|
[ethernet]
|
||||||
command=ip -o -4 addr show enp6s0 | awk '{print " LAN: "$4}' || echo " LAN: down" # for Ethernet
|
command=ip -o -4 addr show enp6s0 | awk '{print " LAN: "$4}' || echo " LAN: down" # for Ethernet
|
||||||
interval=10
|
interval=10
|
||||||
|
|||||||
20
i3blocks/volume.sh
Executable file
20
i3blocks/volume.sh
Executable file
@ -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
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user