Browse Source

add pacman plugin to monitor the number of available updates

master
Von Random 2 years ago
parent
commit
c39132ab59
1 changed files with 22 additions and 0 deletions
  1. 22
    0
      plugins/pacman.py

+ 22
- 0
plugins/pacman.py View File

@@ -0,0 +1,22 @@
1
+import os
2
+import random
3
+import plugins
4
+import subprocess
5
+
6
+
7
+class PluginThread(plugins.PluginThreadCommon):
8
+    def __init__(self, section, config):
9
+        super(PluginThread, self).__init__(section, config)
10
+        self.freq = config.getint(section, 'freq', fallback=180)
11
+        self.format_status(0)
12
+
13
+    def format_status(self, count):
14
+        self.status['full_text'] = 'UPD: ' + str(count)
15
+        if count > 0:
16
+            self.hide = False
17
+        else:
18
+            self.hide = True
19
+
20
+    def main(self):
21
+        updates = subprocess.getoutput('/usr/bin/pacman -Sup').count("\n")
22
+        self.format_status(updates)

Loading…
Cancel
Save