first Version
This commit is contained in:
commit
0c4bef47e8
149 changed files with 32273 additions and 0 deletions
22
backup/eww/scripts/bluetooth.sh
Executable file
22
backup/eww/scripts/bluetooth.sh
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Get the list of connected Bluetooth devices
|
||||
devices=$(bluetoothctl devices Connected | awk '{print $2}')
|
||||
|
||||
# Iterate through each device and get its name and battery percentage
|
||||
for device in $devices; do
|
||||
# Get the device info using bluetoothctl
|
||||
info=$(bluetoothctl info $device)
|
||||
|
||||
# Extract the name and battery percentage from the device info
|
||||
name=$(echo "$info" | grep "Name" | awk '{ for(i=2; i<=NF; i++) printf "%s ", $i;}')
|
||||
battery=$(echo "$info" | grep "Battery" | awk '{print $4}' | tr -d '()')
|
||||
done
|
||||
|
||||
eww update bluetoothDevices="$name: $battery%"
|
||||
|
||||
eww update bluetoothBattery="$battery"
|
||||
|
||||
if [[ !$devices ]]; then
|
||||
eww update bluetoothBattery="0"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue