[core] restructure to allow PIP packaging
OK - so I have to admit I *hate* the fact that PIP seems to require a subdirectory named like the library. But since the PIP package is something really nifty to have (thanks to @tony again!!!), I updated the codebase to hopefully conform with what PIP expects. Testruns so far look promising...
This commit is contained in:
parent
1d25be2059
commit
320827d577
146 changed files with 2509 additions and 2 deletions
51
bumblebee_status/modules/contrib/notmuch_count.py
Normal file
51
bumblebee_status/modules/contrib/notmuch_count.py
Normal file
|
@ -0,0 +1,51 @@
|
|||
# pylint: disable=C0111,R0903
|
||||
|
||||
"""Displays the result of a notmuch count query
|
||||
default : unread emails which path do not contained 'Trash' (notmuch count 'tag:unread AND NOT path:/.*Trash.*/')
|
||||
|
||||
Parameters:
|
||||
* notmuch_count.query: notmuch count query to show result
|
||||
|
||||
Errors:
|
||||
if the notmuch query failed, the shown value is -1
|
||||
|
||||
Dependencies:
|
||||
notmuch (https://notmuchmail.org/)
|
||||
|
||||
contributed by `abdoulayeYATERA <https://github.com/abdoulayeYATERA>`_ - many thanks!
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import core.module
|
||||
import core.widget
|
||||
|
||||
import util.cli
|
||||
|
||||
|
||||
class Module(core.module.Module):
|
||||
def __init__(self, config, theme):
|
||||
super().__init__(config, theme, core.widget.Widget(self.output))
|
||||
|
||||
self.__notmuch_count_query = self.parameter(
|
||||
"query", "tag:unread AND NOT path:/.*Trash.*/"
|
||||
)
|
||||
|
||||
def output(self, widget):
|
||||
return self.__notmuch_count
|
||||
|
||||
def state(self, widgets):
|
||||
if self.__notmuch_count == 0:
|
||||
return "empty"
|
||||
return "items"
|
||||
|
||||
def update(self):
|
||||
try:
|
||||
self.__notmuch_count = util.cli.execute(
|
||||
"notmuch count {}".format(self.__notmuch_count_query)
|
||||
).strip()
|
||||
except Exception:
|
||||
self.__notmuch_count = "n/a"
|
||||
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
Loading…
Add table
Add a link
Reference in a new issue