From c470ba978cffd47c735f77f517294275f0406b14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20H=C3=B6her?= Date: Wed, 7 Sep 2022 19:48:11 +0200 Subject: [PATCH] Use new bluetoothctl commands --- rofi-bluetooth | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rofi-bluetooth b/rofi-bluetooth index 5c52fd8..498d854 100755 --- a/rofi-bluetooth +++ b/rofi-bluetooth @@ -185,7 +185,13 @@ print_status() { if power_on; then printf '' - mapfile -t paired_devices < <(bluetoothctl paired-devices | grep Device | cut -d ' ' -f 2) + paired_devices_cmd="devices Paired" + # Check if an outdated version of bluetoothctl is used to preserve backwards compatibility + if (( $(echo "$(bluetoothctl version | cut -d ' ' -f 2) < 5.65" | bc -l) )); then + paired_devices_cmd="paired-devices" + fi + + mapfile -t paired_devices < <(bluetoothctl $paired_devices_cmd | grep Device | cut -d ' ' -f 2) counter=0 for device in "${paired_devices[@]}"; do