updated eww files and bash scripts
This commit is contained in:
parent
5a419c03f3
commit
cd7e93374e
11 changed files with 119 additions and 60 deletions
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Get the list of connected Bluetooth devices
|
||||
devices=$(bluetoothctl devices Connected | awk '{print $2}')
|
||||
|
@ -9,15 +9,15 @@ i=0
|
|||
for device in $devices; do
|
||||
|
||||
# Get the device info using bluetoothctl
|
||||
info=$(bluetoothctl info $device)
|
||||
info=$(bluetoothctl info "$device")
|
||||
|
||||
# Extract the name and battery percentage from the device info
|
||||
name[$i]=$(echo "$info" | awk '/Name:/ {for(i=2; i<=NF; i++) printf "%s ", $i;}')
|
||||
battery[$i]=$(echo "$info" | awk '/Battery Percentage:/ {print $4}' | tr -d '()')
|
||||
name[i]=$(echo "$info" | awk '/Name:/ {for(i=2; i<=NF; i++) printf "%s ", $i;}')
|
||||
battery[i]=$(echo "$info" | awk '/Battery Percentage:/ {print $4}' | tr -d '()')
|
||||
|
||||
|
||||
|
||||
((i=i+1))
|
||||
done
|
||||
|
||||
echo '{"name":"'${name[0]}'","battery":"'${battery[0]}'"}'
|
||||
echo '{"name":"'"${name[0]}"'","battery":"'"${battery[0]}"'"}'
|
Loading…
Add table
Add a link
Reference in a new issue