Skip to content

Commit

Permalink
Use new bluetoothctl commands
Browse files Browse the repository at this point in the history
  • Loading branch information
nhoeher committed Sep 7, 2022
1 parent 893db1f commit c470ba9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rofi-bluetooth
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c470ba9

Please sign in to comment.