Created
January 12, 2016 14:50
-
-
Save alexandregz/9b5007853833c83e39fe to your computer and use it in GitHub Desktop.
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 ruby | |
# <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 | |
# | |
require 'yaml' | |
output = YAML.load(`system_profiler SPBluetoothDataType`); | |
output['Bluetooth']['Devices (Paired, Configured, etc.)'].each do |device| | |
puts "Keyboard: "+device[1]['Battery Level'].to_s if device[1]['Minor Type'].eql?('Keyboard') && device[1].has_key?('Battery Level') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment