Last active
January 11, 2016 15:49
-
-
Save alexandregz/ea292941c641b09dfbd3 to your computer and use it in GitHub Desktop.
bitbar plugin using system_profiler command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# <bitbar.title>Battery Apple Bluetooth keyboard</bitbar.title> | |
# <bitbar.version>1.0</bitbar.version> | |
# <bitbar.author>Alexandre Espinosa Menor</bitbar.author> | |
# <bitbar.author.github>alexandregz</bitbar.author.github> | |
# <bitbar.desc>Show vagrant images running, from vagrant global-status command</bitbar.desc> | |
# | |
# command from https://github.com/matryer/bitbar-plugins/issues/84 by @keithamus | |
# | |
use strict; | |
my $output = `system_profiler SPBluetoothDataType`; | |
if($output =~ /Minor Type: Keyboard.*Battery Level: (\d+)/sm) { | |
print "Keyboard: $1%"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fine, thx. I had the mouse before the keyboard O:-)