Regenerated
This commit is contained in:
+285
-285
File diff suppressed because it is too large
Load Diff
+5
-5
@@ -2988,24 +2988,24 @@ window#waybar {
|
||||
These are config files for waybar
|
||||
#+BEGIN_SRC sh :tangle generated/.config/waybar/scripts/bluetooth-status.sh :noweb yes :mkdirp yes :eval never
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Collect connected devices
|
||||
bt_connected=$(bluetoothctl devices | while read -r line; do
|
||||
mac=$(echo "$line" | awk '{print $2}')
|
||||
if [ "$(bluetoothctl info "$mac" | awk '/Connected:/ {print $2}')" = "yes" ]; then
|
||||
echo "$line" | cut -d' ' -f3-
|
||||
fi
|
||||
done)
|
||||
done | sed '/^$/d') # remove empty lines
|
||||
|
||||
# Determine the icon
|
||||
if [ -n "$bt_connected" ]; then
|
||||
icon=""
|
||||
else
|
||||
icon=""
|
||||
fi
|
||||
# Output: main icon for Waybar, then connected devices for tooltip
|
||||
echo -n "$icon"
|
||||
# Pass connected device names as JSON output for Waybar tooltip
|
||||
echo "$bt_connected" | jq -R -s '{output: .}'
|
||||
|
||||
# Output valid JSON for Waybar
|
||||
jq -n --arg text "$icon" --arg tooltip "$bt_connected" '{text: $text, tooltip: $tooltip}'
|
||||
#+END_SRC
|
||||
|
||||
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Collect connected devices
|
||||
bt_connected=$(bluetoothctl devices | while read -r line; do
|
||||
mac=$(echo "$line" | awk '{print $2}')
|
||||
if [ "$(bluetoothctl info "$mac" | awk '/Connected:/ {print $2}')" = "yes" ]; then
|
||||
echo "$line" | cut -d' ' -f3-
|
||||
fi
|
||||
done)
|
||||
done | sed '/^$/d') # remove empty lines
|
||||
|
||||
# Determine the icon
|
||||
if [ -n "$bt_connected" ]; then
|
||||
icon=""
|
||||
else
|
||||
icon=""
|
||||
fi
|
||||
# Output: main icon for Waybar, then connected devices for tooltip
|
||||
echo -n "$icon"
|
||||
# Pass connected device names as JSON output for Waybar tooltip
|
||||
echo "$bt_connected" | jq -R -s '{output: .}'
|
||||
|
||||
# Output valid JSON for Waybar
|
||||
jq -n --arg text "$icon" --arg tooltip "$bt_connected" '{text: $text, tooltip: $tooltip}'
|
||||
|
||||
Reference in New Issue
Block a user