nixos-config/modules/workspace/i3blocks/scripts/email.nix

15 lines
422 B
Nix
Raw Normal View History

2020-02-17 17:00:59 +04:00
{ python3, iconfont, config, ... }: ''
#!${python3}/bin/python3
import imaplib
2021-01-13 15:45:01 +04:00
obj = imaplib.IMAP4_SSL('balsoft.ru', 993)
2021-01-26 23:19:54 +04:00
password = open("${config.secrets.email.decrypted}").read()[:-1:]
obj.login("balsoft@balsoft.ru", password)
2020-02-17 17:00:59 +04:00
obj.select()
l = len(obj.search(None, 'unseen')[1][0].split())
2020-07-27 01:16:19 +04:00
if l == 0:
print('')
else:
print('<span font="${iconfont}"></span> %s' % str(l))
exit(33)
2020-02-17 17:00:59 +04:00
''