2017-01-12 15:56:32 +02:00
|
|
|
import plugins
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
class PluginThread(plugins.PluginThreadCommon):
|
2017-12-16 01:55:28 +02:00
|
|
|
def __init__(self, config):
|
|
|
|
defaults = {'freq': 15}
|
|
|
|
super(PluginThread, self).__init__(config, defaults)
|
2017-01-12 15:56:32 +02:00
|
|
|
self.format_status(0)
|
|
|
|
|
|
|
|
def format_status(self, count):
|
|
|
|
self.status['full_text'] = 'UPD: ' + str(count)
|
|
|
|
if count > 0:
|
|
|
|
self.hide = False
|
2017-01-13 10:22:08 +02:00
|
|
|
self.status['urgent'] = True
|
2017-01-12 15:56:32 +02:00
|
|
|
else:
|
|
|
|
self.hide = True
|
2017-01-13 10:22:08 +02:00
|
|
|
self.status['urgent'] = False
|
2017-01-12 15:56:32 +02:00
|
|
|
|
|
|
|
def main(self):
|
2017-01-13 13:30:52 +02:00
|
|
|
# TODO: this is an ugly hack, fix it with subprocess.Popen asap
|
|
|
|
updates = subprocess.getoutput('/usr/bin/pacman -Qu').count(" -> ")
|
2017-01-12 15:56:32 +02:00
|
|
|
self.format_status(updates)
|