From 25263a9516f1b147f7b61c87c0d96e8458b3b9bb Mon Sep 17 00:00:00 2001 From: Andrew Date: Fri, 19 Jul 2024 14:42:27 +0100 Subject: [PATCH] bluetooth_info.pl: Display '?' if battery level unknown --- bluetooth_info.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluetooth_info.pl b/bluetooth_info.pl index 1195de8..f5508a5 100755 --- a/bluetooth_info.pl +++ b/bluetooth_info.pl @@ -9,7 +9,7 @@ my $output = `bluetoothctl info` or die("disconnected\n"); my $mac_address = ($output =~ /^Device\s+(\S+)/) ? "$1" : die("disconnected\n"); my $device_name = ($output =~ /Name:\s+(.*)/) ? "$1" : "unknown"; my $icon = ($output =~ /Icon:\s+(.*)/) ? "$1" : ""; -my $battery_percentage = ($output =~ /Battery Percentage:\s+\S+\s\(([0-9]+)\)/) ? "$1" : ""; +my $battery_percentage = ($output =~ /Battery Percentage:\s+\S+\s\(([0-9]+)\)/) ? "$1" : "?"; if ($icon eq "audio-headphones") { printf(" ");