summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVon Random <von@vdrandom.org>2017-01-12 16:56:32 +0300
committerVon Random <von@vdrandom.org>2017-01-12 16:56:32 +0300
commitc39132ab599cd0694618a3563371f645287dc112 (patch)
treeeb3b41520b0799ecb30798b1fc0545d62489a1e9
parent5616f4d575de06a48834b645d214dae9388e77c5 (diff)
add pacman plugin to monitor the number of available updates
-rw-r--r--plugins/pacman.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/plugins/pacman.py b/plugins/pacman.py
new file mode 100644
index 0000000..663e857
--- /dev/null
+++ b/plugins/pacman.py
@@ -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)