12345678910111213141516171819 |
- import json
- import subprocess
- new_mail_list = json.loads(
- subprocess.check_output(
- ["notmuch", "show", "--format=json", "tag:inbox"],
- ).decode('utf-8')
- )
- if new_mail_list:
- output = "Mail's here!\n\n"
- for message in new_mail_list:
- msg = message[0][0]
- dt = msg['headers']['Date']
- subj = msg['headers']['Subject']
- output += f"{dt}\n{subj}\n\n"
- subprocess.run(["dunstify", output])
|