@@ -0,0 +1,2115 @@
+#!/usr/bin/env python3%0A%0Aimport os%0Aimport re%0Aimport sys%0Aimport datetime%0Aimport subprocess%0A%0Afrom widgets.widget import Widget%0Afrom widgets.config import colors, icons%0A%0Aclass Battery(Widget):%0A    '''%0A    '''%0A%0A    def __init__(self, value=''):%0A        '''%0A        Params:%0A            bg: background color%0A            fg: foreground color%0A            icon: icon%0A        '''%0A        Widget.__init__(self)%0A        self.value = value%0A%0A        self.bg = None%0A        self.fg = colors%5B'c_white'%5D%0A        self.icon = icons%5B'battery_full'%5D%0A        self.gaps = (10, 7)%0A        self.charge = 0%0A        self.show_text = False%0A%0A        self.colors_rules = dict()%0A        self.action = %5B%5D%0A        self.action_buttons = %5B%5D%0A%0A    def update(self):%0A        '''%0A%0A        TO IMPLEMENT.%0A%0A        '''%0A        cmd = '/'.join(os.path.realpath(__file__).split('/')%5B:-1%5D) + %5C%0A                '/utils/battery'%0A%0A        process = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)%0A        output = process.communicate()%5B0%5D%0A%0A        percentage = output.decode('UTF-8')%5B0:2%5D%0A%0A        self.charge = int(percentage)%0A        if self.charge == 99 or self.charge == 100:%0A            self.icon = icons%5B'battery_full'%5D%0A            self.fg = colors%5B'c_white'%5D%0A        elif self.charge %3C 76:%0A            self.icon = icons%5B'battery_tquarter'%5D%0A            self.fg = colors%5B'c_white'%5D%0A        elif self.charge %3C 51:%0A            self.icon = icons%5B'battery_half'%5D%0A            self.fg = colors%5B'c_white'%5D%0A        elif self.charge %3C 26:%0A            self.icon = icons%5B'battery_quarter'%5D%0A            self.fg = colors%5B'c_yellow_d'%5D%0A        elif self.charge %3C 10:%0A            self.icon = icons%5B'battery_empty'%5D%0A            self.fg = colors%5B'c_red_l'%5D%0A        else:%0A            self.icon = icons%5B'battery_full'%5D%0A            self.fg = colors%5B'c_white'%5D%0A%0A        if self.show_text:%0A            self.value = str(self.charge) + '%25'%0A            self.show_text = False%0A        else:%0A            self.value = ''%0A%0A    def execute(self, cmd):%0A        if cmd == 'batt':%0A            self.show_text = True%0A%0Aif __name__ == '__main__':%0A    a = Widget()%0A%0A    print(a.get_output())%0A

Add battery widget.