add the new_mail module

This commit is contained in:
stupidcomputer 2024-05-17 10:33:46 -05:00
parent 921c36dc0f
commit f28f9837f6
1 changed files with 12 additions and 2 deletions

View File

@ -54,6 +54,16 @@ def filemodfactory(filename: str, modname: str):
return filemod return filemod
def new_mail(queue, _):
while True:
dir_output = os.listdir("/home/usr/Mail/main/INBOX/new")
dir_output = len(dir_output)
queue.put({
"module": "newmail",
"data": str(dir_output)
})
time.sleep(20)
def bspwm(queue, monitor): def bspwm(queue, monitor):
client = socket.socket( client = socket.socket(
socket.AF_UNIX, socket.AF_UNIX,
@ -112,7 +122,7 @@ def render(modules) -> str:
columns, _ = os.get_terminal_size(0) columns, _ = os.get_terminal_size(0)
left = "{} | {}({})".format(modules["clock"], modules["bspwm"], modules["sxhkdmode"]) left = "{} | {}({})".format(modules["clock"], modules["bspwm"], modules["sxhkdmode"])
right = "{}({})".format(modules["bat"], modules["batstat"]) right = "{} {}({})".format(modules["newmail"], modules["bat"], modules["batstat"])
padding = " " * (columns - len(left) - len(right) - 0) padding = " " * (columns - len(left) - len(right) - 0)
output = left + padding + right output = left + padding + right
@ -163,7 +173,7 @@ def main():
)) ))
return return
queue = Queue() queue = Queue()
modules = [bspwm, clock, battery, batterystatus, sxhkdmode] modules = [bspwm, clock, battery, batterystatus, sxhkdmode, new_mail]
[Process(target=module, args=(queue, argv[1])).start() for module in modules] [Process(target=module, args=(queue, argv[1])).start() for module in modules]
module_outputs = defaultdict(lambda: "") module_outputs = defaultdict(lambda: "")