@@ -0,0 +1,963 @@
+#!/usr/bin/env python%0A# coding=UTF-8%0A%0Aimport math, subprocess%0A%0Ap = subprocess.Popen(%5B%22ioreg%22, %22-rc%22, %22AppleSmartBattery%22%5D, stdout=subprocess.PIPE)%0Aoutput = p.communicate()%5B0%5D%0A%0Ao_max = %5Bl for l in output.splitlines() if 'MaxCapacity' in l%5D%5B0%5D%0Ao_cur = %5Bl for l in output.splitlines() if 'CurrentCapacity' in l%5D%5B0%5D%0A%0Ab_max = float(o_max.rpartition('=')%5B-1%5D.strip())%0Ab_cur = float(o_cur.rpartition('=')%5B-1%5D.strip())%0A%0Acharge = b_cur / b_max%0Acharge_threshold = int(math.ceil(10 * charge))%0A%0A# Output%0A%0Atotal_slots, slots = 10, %5B%5D%0Afilled = int(math.ceil(charge_threshold * (total_slots / 10.0))) * u'%E2%96%B8'%0Aempty = (total_slots - len(filled)) * u'%E2%96%B9'%0A%0Aout = (filled + empty).encode('utf-8')%0Aimport sys%0A%0Acolor_green = '%25%7B%1B%5B32m%25%7D'%0Acolor_yellow = '%25%7B%1B%5B1;33m%25%7D'%0Acolor_red = '%25%7B%1B%5B31m%25%7D'%0Acolor_reset = '%25%7B%1B%5B00m%25%7D'%0Acolor_out = (%0A    color_green if len(filled) %3E 6%0A    else color_yellow if len(filled) %3E 4%0A    else color_red%0A)%0A%0Aout = color_out + out + color_reset%0Asys.stdout.write(out)%0A

Add battery charge script