Regenerated
This commit is contained in:
+292
-290
File diff suppressed because it is too large
Load Diff
+12
-10
@@ -2988,23 +2988,25 @@ These are config files for waybar
|
|||||||
#+BEGIN_SRC sh :tangle generated/.config/waybar/scripts/bluetooth-status.sh :noweb yes :mkdirp yes :eval never
|
#+BEGIN_SRC sh :tangle generated/.config/waybar/scripts/bluetooth-status.sh :noweb yes :mkdirp yes :eval never
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
bt_connected=$(bluetoothctl devices | while read -r line; do
|
bt_connected=""
|
||||||
mac=$(echo "$line" | awk '{print $2}')
|
|
||||||
|
while read -r _ mac name_rest; do
|
||||||
if [ "$(bluetoothctl info "$mac" | awk '/Connected:/ {print $2}')" = "yes" ]; then
|
if [ "$(bluetoothctl info "$mac" | awk '/Connected:/ {print $2}')" = "yes" ]; then
|
||||||
echo "$line" | cut -d' ' -f3-
|
bt_connected+="$name_rest\n"
|
||||||
fi
|
fi
|
||||||
done)
|
done < <(bluetoothctl devices)
|
||||||
|
|
||||||
icon=""
|
|
||||||
tooltip=null
|
|
||||||
|
|
||||||
|
# icon
|
||||||
if [ -n "$bt_connected" ]; then
|
if [ -n "$bt_connected" ]; then
|
||||||
icon=""
|
icon=""
|
||||||
tooltip=$(echo "$bt_connected" | jq -R -s '.')
|
tooltip=$(printf "%b" "$bt_connected")
|
||||||
|
else
|
||||||
|
icon=""
|
||||||
|
tooltip="No devices connected"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Output JSON for Waybar
|
# ALWAYS produce valid JSON
|
||||||
jq -n --arg text "$icon" --argjson tooltip "$tooltip" '{text: $text, tooltip: $tooltip}'
|
printf '{"text": "%s", "tooltip": "%s"}\n' "$icon" "$tooltip"
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,21 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
bt_connected=$(bluetoothctl devices | while read -r line; do
|
bt_connected=""
|
||||||
mac=$(echo "$line" | awk '{print $2}')
|
|
||||||
|
while read -r _ mac name_rest; do
|
||||||
if [ "$(bluetoothctl info "$mac" | awk '/Connected:/ {print $2}')" = "yes" ]; then
|
if [ "$(bluetoothctl info "$mac" | awk '/Connected:/ {print $2}')" = "yes" ]; then
|
||||||
echo "$line" | cut -d' ' -f3-
|
bt_connected+="$name_rest\n"
|
||||||
fi
|
fi
|
||||||
done)
|
done < <(bluetoothctl devices)
|
||||||
|
|
||||||
icon=""
|
|
||||||
tooltip=null
|
|
||||||
|
|
||||||
|
# icon
|
||||||
if [ -n "$bt_connected" ]; then
|
if [ -n "$bt_connected" ]; then
|
||||||
icon=""
|
icon=""
|
||||||
tooltip=$(echo "$bt_connected" | jq -R -s '.')
|
tooltip=$(printf "%b" "$bt_connected")
|
||||||
|
else
|
||||||
|
icon=""
|
||||||
|
tooltip="No devices connected"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Output JSON for Waybar
|
# ALWAYS produce valid JSON
|
||||||
jq -n --arg text "$icon" --argjson tooltip "$tooltip" '{text: $text, tooltip: $tooltip}'
|
printf '{"text": "%s", "tooltip": "%s"}\n' "$icon" "$tooltip"
|
||||||
|
|||||||
Reference in New Issue
Block a user