we now use cat instead of redundant check function

This commit is contained in:
kaylee 2024-02-02 23:52:53 +00:00
parent 16ba974df7
commit 0a56d15a83
2 changed files with 7 additions and 6 deletions

View File

@ -6,17 +6,13 @@ alerts u when u have unread messages by adding 📬 to your bash prompt
- configure your imap server in `~/.uvgotmail/config` file. you can also use an existing `.muttrc` file.
- add `(./uvgotmail.py --daemon &)` to the end of your `.bashrc` file
- find the line where your PS1 is set and put `\$(./uvgotmail.py --check)` at the start
- find the line where your PS1 is set and put `\$(cat ~/.uvgotmail/unread)` at the start
## OPTIONS:
### check mode
- `--mailbox-symbol [string]`: specify your own symbol instead of 📬
- `--no-count`: by default, if you have multiple messages you will get `(n) 📬` in your PS1. this option turns that off.
### daemon mode
- `--config [path]`: path to config file
- `--mutt`: load server settings from .muttrc file

View File

@ -184,7 +184,12 @@ def check():
def writeUnreadFile(unseen):
try:
with open(os.path.expanduser('~/.uvgotmail/unread'),'w') as f:
f.write(str(len(unseen)))
if len(unseen) == 0:
f.write('')
elif(len(unseen) > 1 and config["no_count"] == False):
f.write("("+str(len(unseen))+") "+config["mailbox_symbol"]+' ')
else:
f.write(config["mailbox_symbol"]+' ')
except Exception as e:
if config["debug"]: print(e)
print("uvgotmail: could not write to unread file")