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):
|
2018-04-28 19:40:10 +03:00
|
|
|
defaults = {
|
|
|
|
'freq': 15,
|
|
|
|
'problem': 10
|
|
|
|
}
|
2017-12-16 01:55:28 +02:00
|
|
|
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)
|
2018-04-28 19:40:10 +03:00
|
|
|
self.hide = count == 0
|
|
|
|
self.status['urgent'] = count >= self.conf['problem']
|
2017-01-12 15:56:32 +02:00
|
|
|
|
|
|
|
def main(self):
|
2018-11-02 19:15:33 +02:00
|
|
|
# TODO: this is an ugly hack, fix it with subprocess.Popen someday
|
2017-01-13 13:30:52 +02:00
|
|
|
updates = subprocess.getoutput('/usr/bin/pacman -Qu').count(" -> ")
|
2017-01-12 15:56:32 +02:00
|
|
|
self.format_status(updates)
|