blob: 625314b3729cadd332051b73f07fc5bcab5ab660 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import plugins
import subprocess
PACMAN_DEFAULTS = {
'cmd': ('/usr/bin/pacman', '-Qu'),
'title': 'UPD', 'freq': 15, 'problem': 10
}
class PluginThread(plugins.PluginThreadCommon):
def __init__(self, config):
super(PluginThread, self).__init__(config, PACMAN_DEFAULTS)
def main(self):
pacman_qu = subprocess.Popen(
self.conf['cmd'], stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL,
encoding='UTF-8'
)
out = pacman_qu.communicate()[0].strip().splitlines()
packages = len([pkg for pkg in out if not '[ignored]' in pkg])
if packages:
self.hide = False
else:
self.hide = True
self.format_status(
str(packages), urgent=packages >= self.conf['problem']
)
|