power menu, redshift, polybar
This commit is contained in:
29
.config/polybar/scripts/inbox-imap-pythongpg/README.md
Normal file
29
.config/polybar/scripts/inbox-imap-pythongpg/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Script: inbox-imap-pythongpg
|
||||
|
||||
A script that shows if there are unread mails in your IMAPs inbox. Passwords are encrypted with gpg.
|
||||
|
||||

|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
You must have a gpg key to secure your password in configuration files. Encrypt your password using your gpg key like this.
|
||||
|
||||
```ini
|
||||
echo 'your password' > /tmp/imappass
|
||||
gpg -er 'your gpg keyid' /tmp/imappass
|
||||
mv /tmp/imappass.gpg ~/.imappass.gpg
|
||||
shred /tmp/imappass && rm /tmp/imappass
|
||||
```
|
||||
|
||||
For Gmail, you must allow [less secure apps](https://myaccount.google.com/security#connectedapps).
|
||||
|
||||
|
||||
## Module
|
||||
|
||||
```ini
|
||||
[module/inbox-imap-pythongpg]
|
||||
type = custom/script
|
||||
exec = ~/polybar-scripts/inbox-imap-pythongpg.py
|
||||
interval = 60
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import imaplib
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
completed_process = subprocess.run(['gpg', '-dq', os.path.join(os.getenv('HOME'), '.imappass.gpg')], check=True, stdout=subprocess.PIPE, encoding="utf-8");
|
||||
password = completed_process.stdout[:-1]
|
||||
obj = imaplib.IMAP4_SSL('imap.mail.net', 993)
|
||||
# Only put your email address below.
|
||||
obj.login('your email address', password)
|
||||
obj.select()
|
||||
|
||||
print(len(obj.search(None, 'unseen')[1][0].split()))
|
||||
BIN
.config/polybar/scripts/inbox-imap-pythongpg/screenshots/1.png
Normal file
BIN
.config/polybar/scripts/inbox-imap-pythongpg/screenshots/1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 542 B |
Reference in New Issue
Block a user