Browse Source

plugins: allow disabling of title field; pacman: rename to cmd; cmd: use first line of output as value, not line count

master
Von Random 1 year ago
parent
commit
b03a588182
2 changed files with 5 additions and 11 deletions
  1. +1
    -1
      plugins/__init__.py
  2. +4
    -10
      plugins/cmd.py

+ 1
- 1
plugins/__init__.py View File

@ -18,7 +18,7 @@ class PluginThreadCommon:
self.thread.daemon = True
def format_status(self, status, urgent=False):
if 'title' in self.conf:
if 'title' in self.conf and self.conf['title']:
full_text = '{}: {}'.format(self.conf['title'], status)
else:
full_text = status


plugins/pacman.py → plugins/cmd.py View File

@ -3,8 +3,8 @@ import subprocess
PACMAN_DEFAULTS = {
'cmd': ('/usr/bin/pacman', '-Qu'),
'title': 'UPD', 'freq': 15, 'problem': 10
'cmd': ('/usr/bin/echo', 'I am cmd'),
'title': 'CMD', 'freq': 15
}
@ -18,12 +18,6 @@ class PluginThread(plugins.PluginThreadCommon):
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
out = pacman_qu.communicate()[0].strip().splitlines()[0]
urgent = packages >= self.conf['problem']
self.format_status(packages, urgent)
self.format_status(out)

Loading…
Cancel
Save