add pacman plugin to monitor the number of available updates
This commit is contained in:
parent
5616f4d575
commit
c39132ab59
1 changed files with 22 additions and 0 deletions
22
plugins/pacman.py
Normal file
22
plugins/pacman.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
import os
|
||||||
|
import random
|
||||||
|
import plugins
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
class PluginThread(plugins.PluginThreadCommon):
|
||||||
|
def __init__(self, section, config):
|
||||||
|
super(PluginThread, self).__init__(section, config)
|
||||||
|
self.freq = config.getint(section, 'freq', fallback=180)
|
||||||
|
self.format_status(0)
|
||||||
|
|
||||||
|
def format_status(self, count):
|
||||||
|
self.status['full_text'] = 'UPD: ' + str(count)
|
||||||
|
if count > 0:
|
||||||
|
self.hide = False
|
||||||
|
else:
|
||||||
|
self.hide = True
|
||||||
|
|
||||||
|
def main(self):
|
||||||
|
updates = subprocess.getoutput('/usr/bin/pacman -Sup').count("\n")
|
||||||
|
self.format_status(updates)
|
Loading…
Reference in a new issue