From 222d16ebf4bad80683e37413d4991a97eb20adee Mon Sep 17 00:00:00 2001 From: Penelope Gwen Date: Sun, 4 Jan 2026 17:45:02 -0800 Subject: [PATCH] New backup 2026-01-04 17:45:01 --- de/home/.config/eww/scripts/bar/bluetooth | 35 +++++++++++------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/de/home/.config/eww/scripts/bar/bluetooth b/de/home/.config/eww/scripts/bar/bluetooth index 5472d3c..66041fb 100755 --- a/de/home/.config/eww/scripts/bar/bluetooth +++ b/de/home/.config/eww/scripts/bar/bluetooth @@ -2,34 +2,33 @@ function btstatus(){ - device_mac_list=$(bluetoothctl devices Paired | awk '{print $2}') +# device_mac_list= device_json_array=() - for m in ${device_mac_list};do - device_name="$(bluetoothctl info ${m} | grep 'Name: ' | sed 's/.*Name: //')" - device_connected="$(bluetoothctl info ${m} | grep 'Connected: ' | sed 's/.*Connected: //')" - device_icon="$(bluetoothctl info ${m} | grep 'Icon: ' | sed 's/.*Icon: //')" - case "${device_icon}" in + for m in $(bluetoothctl devices Paired | awk '{print $2}');do + read -d "\n" dev_name dev_icon dev_connected <<<"$(bluetoothctl info ${m} | grep -e 'Connected\: \|Name\: \|Icon\: ' | awk '{print $2}')" + case "${dev_icon}" in "input-mouse") - device_icon="󰍽";; + dev_icon="󰍽";; "phone") - device_icon="";; + dev_icon="";; "input-keyboard") - device_icon="";; + dev_icon="";; "input-gaming") - device_icon="";; + dev_icon="";; "audio-headphones") - device_icon="";; + dev_icon="";; "audio-headset") - device_icon="";; + dev_icon="";; "computer") - device_icon="";; + dev_icon="";; esac - device_json=$( jq -n --arg name "${device_name}" --arg connected "${device_connected}" --arg icon "${device_icon}" --arg address "${m}" '{name: $name, connected: $connected, icon: $icon, address: $address}') - device_json_array+=("${device_json}") - done - devices_json=$(printf '%s\n' "${device_json_array[@]}" | jq -s .) - echo ${devices_json} +# device_json=$( jq -n --arg name "${dev_name}" --arg connected "${dev_connected}" --arg icon "${dev_icon}" --arg address "${m}" '{name: $name, connected: $connected, icon: $icon, address: $address}') +# device_json_array+=("${device_json}") + printf '%s;%s;%s;%s\n' "${m}" "${dev_name}" "${dev_icon}" "${dev_connected}" + done | column -t -N mac,name,icon,connected -s ';' +# devices_json=$(printf '%s\n' "${device_json_array[@]}" | jq -s .) +# echo ${devices_json} } btstatus