Mu4e: Use ~/.config for imapnotify + missed chunk

This commit is contained in:
TEC 2020-10-14 00:39:40 +08:00
parent 70e1b8ce22
commit 899ac339d4
1 changed files with 18 additions and 14 deletions

View File

@ -2249,7 +2249,7 @@ Prevents a series of redisplays from being called (when set to an appropriate va
**** Config transcoding & service management
As long as the =mbsyncrc= file exists, this is as easy as running
#+begin_src shell :tangle (if (file-exists-p "~/.imapnotify") "no" "setup.sh")
#+begin_src shell :tangle (if (file-exists-p "~/.config/imapnotify") "no" "setup.sh")
~/.config/doom/misc/mbsync-imapnotify.py
#+end_src
@ -2285,7 +2285,7 @@ import fnmatch
mbsyncFile = Path("~/.mbsyncrc").expanduser()
imapnotifyConfigFolder = Path("~/.imapnotify/").expanduser()
imapnotifyConfigFolder = Path("~/.config/imapnotify/").expanduser()
imapnotifyConfigFolder.mkdir(exist_ok=True)
imapnotifyConfigFilename = "notify.conf"
@ -2333,7 +2333,7 @@ def processLine(line):
if parameter == "IMAPAccount":
if currentAccountNumber > 0:
finaliseAccount()
newAccount(value)
newAccount(value)
elif parameter in mbsyncInotifyMapping.keys():
parser, key = mbsyncInotifyMapping[parameter]
currentAccountData[key] = parser(value)
@ -2561,29 +2561,33 @@ def getAccountServiceStates(accounts):
if len(sys.argv) > 1:
if sys.argv[1] == "--enable":
if sys.argv[1] in ["-e", "--enable"]:
enableAccountSystemdServices(oldAccounts)
exit()
elif sys.argv[1] == "--disable":
elif sys.argv[1] in ["-d", "--disable"]:
disableAccountSystemdServices(oldAccounts)
exit()
elif sys.argv[1] == "--status":
elif sys.argv[1] in ["-r", "--restart"]:
restartAccountSystemdServices(oldAccounts)
exit()
elif sys.argv[1] in ["-s", "--status"]:
getAccountServiceStates(oldAccounts)
exit()
elif sys.argv[1] == "--help":
elif sys.argv[1] in ["-h", "--help"]:
print("""\033[1;37mMbsync to IMAP Notify config generator.\033[0;37m
Usage: mbsync-imapnotify [options]
Options:
--enable enable all services
--disable disable all services
--status fetch the status for all services
--help show this help
-e, --enable enable all services
-d, --disable disable all services
-r, --restart restart all services
-s, --status fetch the status for all services
-h, --help show this help
""", end='')
exit()
else:
print(f"\033[0;31mFlag {sys.argv[1]} not recognised\033[0;37m")
print(f"\033[0;31mFlag {sys.argv[1]} not recognised, try --help\033[0;37m")
exit()
@ -2626,11 +2630,11 @@ We'll use a template service file so we can enable a unit per-account.
#+begin_src systemd :tangle ~/.config/systemd/user/goimapnotify@.service
[Unit]
Description=IMAP notifier using IDLE, golang version.
ConditionPathExists=%h/.imapnotify/%I/notify.conf
ConditionPathExists=%h/.config/imapnotify/%I/notify.conf
After=network.target
[Service]
ExecStart=%h/.local/bin/goimapnotify -conf %h/.imapnotify/%I/notify.conf
ExecStart=%h/.local/bin/goimapnotify -conf %h/.config/imapnotify/%I/notify.conf
Restart=always
RestartSec=30