(Scripts/status)~bluetooth-status now prints battery info if found

This commit is contained in:
2024-04-23 17:06:01 +05:30
parent e46d8b18ea
commit ae73ed6dc6

View File

@@ -1,9 +1,15 @@
#!/usr/bin/env sh
name=$(bluetoothctl info | grep "Name" | sed 's/.*Name: //')
battery=$(bluetoothctl info | grep "Battery" | sed 's/.*(//;s/)//')
if [ ! "$name" ]
then
echo ""
else
echo "" $name;
echo -n "" $name;
if [ "$battery" ]
then
echo -n " ($battery%)"
fi
echo ""
fi