updated the not connected string for pixelbuds

This commit is contained in:
2025-08-15 17:23:03 +02:00
parent 1b88c5cc71
commit b81c6e2228

View File

@@ -6,17 +6,12 @@ MAC_ADDRESS="B4:23:A2:09:D3:53"
# --- END CONFIGURATION --- # --- END CONFIGURATION ---
not_connected() { not_connected() {
printf '{"text": "L: --- | R: --- | Off", "tooltip": "Pixel Buds Pro 2", "class": "disconnected"}\n' printf '{"text": "L: --- | R: ---", "tooltip": "Pixel Buds Pro 2 not connected", "class": "disconnected"}\n'
exit 0 exit 0
} }
status() { # This function gets the current status and formats it for Waybar.
# First, check if the device is connected using bluetoothctl. get_status() {
if bluetoothctl info "$MAC_ADDRESS" | grep -q "Connected: yes"; then
# --- DEVICE IS CONNECTED ---
# This function gets the current status and formats it for Waybar.
get_status() {
# Get all info from pbpctrl in one go. Redirect errors to null. # Get all info from pbpctrl in one go. Redirect errors to null.
battery_output=$(pbpctrl show battery 2>/dev/null) battery_output=$(pbpctrl show battery 2>/dev/null)
@@ -72,10 +67,13 @@ status() {
# --- FORMAT OUTPUT --- # --- FORMAT OUTPUT ---
printf '{"text": "%s | %s | %s", "tooltip": "Pixel Buds Pro 2", "class": "%s"}\n' \ printf '{"text": "%s | %s | %s", "tooltip": "Pixel Buds Pro 2", "class": "%s"}\n' \
"$left_display" "$right_display" "$anc_icon" "$class" "$left_display" "$right_display" "$anc_icon" "$class"
} }
status() {
# First, check if the device is connected using bluetoothctl.
if bluetoothctl info "$MAC_ADDRESS" | grep -q "Connected: yes"; then
# --- DEVICE IS CONNECTED ---
get_status get_status
else else
# --- DEVICE IS NOT CONNECTED --- # --- DEVICE IS NOT CONNECTED ---
not_connected not_connected