bluetooth_info.pl: Display '?' if battery level unknown
This commit is contained in:
@ -9,7 +9,7 @@ my $output = `bluetoothctl info` or die("disconnected\n");
|
|||||||
my $mac_address = ($output =~ /^Device\s+(\S+)/) ? "$1" : die("disconnected\n");
|
my $mac_address = ($output =~ /^Device\s+(\S+)/) ? "$1" : die("disconnected\n");
|
||||||
my $device_name = ($output =~ /Name:\s+(.*)/) ? "$1" : "unknown";
|
my $device_name = ($output =~ /Name:\s+(.*)/) ? "$1" : "unknown";
|
||||||
my $icon = ($output =~ /Icon:\s+(.*)/) ? "$1" : "";
|
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") {
|
if ($icon eq "audio-headphones") {
|
||||||
printf(" ");
|
printf(" ");
|
||||||
|
Reference in New Issue
Block a user