[bspwm] start emacs in workspace 3
[~bandali/configs] / offlineimap / .offlineimap.py
1 import os
2 import subprocess
3
4 def mailpasswd(acct):
5 acct = os.path.basename(acct)
6 path = "/home/amin/.passwd/%s.gpg" % acct
7 args = ["gpg", "--use-agent", "--quiet", "--batch", "-d", path]
8 try:
9 return subprocess.check_output(args).strip()
10 except subprocess.CalledProcessError:
11 return ""
12
13 def prime_gpg_agent():
14 ret = False
15 i = 1
16 while not ret:
17 ret = (mailpasswd("prime") == "prime")
18 if i > 2:
19 from offlineimap.ui import getglobalui
20 sys.stderr.write("Error reading in passwords. Terminating.\n")
21 getglobalui().terminate()
22 i += 1
23 return ret
24
25 prime_gpg_agent()