From e57370dbf542b165e430cc8c708677625a9f8ed4 Mon Sep 17 00:00:00 2001 From: JackJ30 Date: Mon, 9 Sep 2024 00:07:54 -0400 Subject: laptop config --- .config/waybar/modules/mail.py | 43 ------------------------------------------ 1 file changed, 43 deletions(-) delete mode 100755 .config/waybar/modules/mail.py (limited to '.config/waybar/modules/mail.py') diff --git a/.config/waybar/modules/mail.py b/.config/waybar/modules/mail.py deleted file mode 100755 index 31958f7..0000000 --- a/.config/waybar/modules/mail.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/python - -import os -import imaplib - -import mailsecrets - -def getmails(username, password, server): - imap = imaplib.IMAP4_SSL(server, 993) - imap.login(username, password) - imap.select('INBOX') - ustatus, uresponse = imap.uid('search', None, 'UNSEEN') - if ustatus == 'OK': - unread_msg_nums = uresponse[0].split() - else: - unread_msg_nums = [] - - fstatus, fresponse = imap.uid('search', None, 'FLAGGED') - if fstatus == 'OK': - flagged_msg_nums = fresponse[0].split() - else: - flagged_msg_nums = [] - - return [len(unread_msg_nums), len(flagged_msg_nums)] - -ping = os.system("ping " + mailsecrets.server + " -c1 > /dev/null 2>&1") -if ping == 0: - mails = getmails(mailsecrets.username, mailsecrets.password, mailsecrets.server) - text = '' - alt = '' - - if mails[0] > 0: - text = alt = str(mails[0]) - if mails[1] > 0: - alt = str(mails[1]) + "  " + alt - else: - exit(1) - - print('{"text":"' + text + '", "alt": "' + alt + '"}') - -else: - exit(1) - -- cgit v1.2.3