New backup 2025-03-04 17:45:01
This commit is contained in:
parent
ec9ea05eca
commit
b790c8ba27
2 changed files with 31 additions and 4 deletions
|
@ -74,7 +74,7 @@
|
||||||
(for device in array
|
(for device in array
|
||||||
(button :onclick 'notify-send ${device.name}'
|
(button :onclick 'notify-send ${device.name}'
|
||||||
:class ""
|
:class ""
|
||||||
"${device.name}"))))
|
"${device.icon}"))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,36 @@ device_json_array=()
|
||||||
for m in ${device_mac_list};do
|
for m in ${device_mac_list};do
|
||||||
device_name="$(bluetoothctl info ${m} | grep 'Name: ' | sed 's/.*Name: //')"
|
device_name="$(bluetoothctl info ${m} | grep 'Name: ' | sed 's/.*Name: //')"
|
||||||
device_icon="$(bluetoothctl info ${m} | grep 'Icon: ' | sed 's/.*Icon: //')"
|
device_icon="$(bluetoothctl info ${m} | grep 'Icon: ' | sed 's/.*Icon: //')"
|
||||||
|
case "${device_icon}" in
|
||||||
|
"input-mouse")
|
||||||
|
device_icon=""
|
||||||
|
;;
|
||||||
|
"phone")
|
||||||
|
device_icon=""
|
||||||
|
;;
|
||||||
|
"input-keyboard")
|
||||||
|
device_icon=""
|
||||||
|
;;
|
||||||
|
"input-gaming")
|
||||||
|
device_icon=""
|
||||||
|
;;
|
||||||
|
"audio-headphones")
|
||||||
|
device_icon=""
|
||||||
|
;;
|
||||||
|
"audio-headset")
|
||||||
|
device_icon=""
|
||||||
|
;;
|
||||||
|
"computer")
|
||||||
|
device_icon=""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
device_json=$( jq -n --arg name "${device_name}" --arg icon "${device_icon}" --arg address "${m}" '{name: $name, icon: $icon, address: $address}')
|
device_json=$( jq -n --arg name "${device_name}" --arg icon "${device_icon}" --arg address "${m}" '{name: $name, icon: $icon, address: $address}')
|
||||||
device_json_array+=(${device_json})
|
device_json_array+=("${device_json}")
|
||||||
|
|
||||||
done
|
done
|
||||||
devices=$(echo "${device_json_array[@]}" | jq '.')
|
#printf '%s\n' "${device_json_array[@]}"
|
||||||
|
#printf '%s\n' "${device_json_array[@]}" | jq -s .
|
||||||
|
devices_json=$(printf '%s\n' "${device_json_array[@]}" | jq -s .)
|
||||||
|
#devices=$(echo "${device_json_array[@]}" | jq '.')
|
||||||
#(echo '[{"name":"mouse"},{"name":"headphones"}]' | jq '.')
|
#(echo '[{"name":"mouse"},{"name":"headphones"}]' | jq '.')
|
||||||
echo ${devices}
|
echo ${devices_json}
|
||||||
|
|
Loading…
Add table
Reference in a new issue