we now use cat instead of redundant check function
This commit is contained in:
parent
16ba974df7
commit
0a56d15a83
|
@ -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.
|
- 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
|
- 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:
|
## OPTIONS:
|
||||||
|
|
||||||
### check mode
|
|
||||||
|
|
||||||
- `--mailbox-symbol [string]`: specify your own symbol instead of 📬
|
- `--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.
|
- `--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
|
- `--config [path]`: path to config file
|
||||||
- `--mutt`: load server settings from .muttrc file
|
- `--mutt`: load server settings from .muttrc file
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,12 @@ def check():
|
||||||
def writeUnreadFile(unseen):
|
def writeUnreadFile(unseen):
|
||||||
try:
|
try:
|
||||||
with open(os.path.expanduser('~/.uvgotmail/unread'),'w') as f:
|
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:
|
except Exception as e:
|
||||||
if config["debug"]: print(e)
|
if config["debug"]: print(e)
|
||||||
print("uvgotmail: could not write to unread file")
|
print("uvgotmail: could not write to unread file")
|
||||||
|
|
Loading…
Reference in New Issue