From 5f293b4f5334b20474b45520451cf74087f60624 Mon Sep 17 00:00:00 2001 From: lelgenio Date: Sat, 17 Oct 2020 03:32:16 -0300 Subject: [PATCH] add username and mail options, using templating where possible --- config.yaml | 8 +++++++- dotfiles/dav/vdirsyncer/config | 12 ++++++------ dotfiles/neomutt/mbsyncrc | 16 ++++++++-------- dotfiles/neomutt/neomuttrc | 11 +++++------ dotfiles/scripts/_get-pass | 3 +++ 5 files changed, 29 insertions(+), 21 deletions(-) create mode 100755 dotfiles/scripts/_get-pass diff --git a/config.yaml b/config.yaml index 40803bc..ea607a2 100644 --- a/config.yaml +++ b/config.yaml @@ -6,6 +6,8 @@ # |_| variables: + username: lelgenio + mail: disroot.org cursor_size: 24 launcher: wofi terminal: kitty @@ -164,6 +166,8 @@ dotfiles: # {{{ mutt: src: neomutt/ dst: ~/.config/neomutt/ + actions: + - cpmbsync crontab: src: crontab dst: ~/.local/share/crontab @@ -207,7 +211,9 @@ actions: #{{{ crontab -r crontab ~/.local/share/crontab vdirsyncer: | - yes | vdirsyncer discover + yes | vdirsyncer discover & disown + cpmbsync: | + ln -fs ~/.config/neomutt/mbsyncrc ~/.mbsyncrc sponsorblock: > test -d ~/.config/mpv/scripts/sponsorblock_shared || git clone diff --git a/dotfiles/dav/vdirsyncer/config b/dotfiles/dav/vdirsyncer/config index 94bac18..bf8f32d 100644 --- a/dotfiles/dav/vdirsyncer/config +++ b/dotfiles/dav/vdirsyncer/config @@ -44,9 +44,9 @@ fileext = ".vcf" [storage contacts_remote] type = "carddav" -url = "https://cloud.disroot.org/remote.php/dav/addressbooks/users/lelgenio/contacts/" -username = "lelgenio@disroot.org" -password.fetch = [ "command", "sh", "-c", "pass Disroot | head -n1" ] +url = "https://cloud.{{@@ mail @@}}/remote.php/dav/addressbooks/users/{{@@ username @@}}/contacts/" +username = "{{@@ username @@}}@{{@@ mail @@}}" +password.fetch = [ "command", "_get-pass", "{{@@ mail @@}}" ] # CALDAV [pair calendar] @@ -64,6 +64,6 @@ fileext = ".ics" [storage calendar_remote] type = "caldav" -url = "https://cloud.disroot.org/remote.php/dav/calendars/lelgenio/personal/" -username = "lelgenio@disroot.org" -password.fetch = [ "command", "sh", "-c", "pass Disroot | head -n1" ] +url = "https://cloud.{{@@ mail @@}}/remote.php/dav/calendars/{{@@ username @@}}/personal/" +username = "{{@@ username @@}}@{{@@ mail @@}}" +password.fetch = [ "command", "_get-pass", "{{@@ mail @@}}" ] diff --git a/dotfiles/neomutt/mbsyncrc b/dotfiles/neomutt/mbsyncrc index 11113cf..f492b69 100644 --- a/dotfiles/neomutt/mbsyncrc +++ b/dotfiles/neomutt/mbsyncrc @@ -1,21 +1,21 @@ -IMAPStore disroot-remote -Host disroot.org +IMAPStore mail-remote +Host {{@@ mail @@}} Port 993 -User lelgenio@disroot.org -PassCmd "pass Disroot | head -n1" +User {{@@ username @@}}@{{@@ mail @@}} +PassCmd "_get-pass {{@@ mail @@}}" SSLType IMAPS CertificateFile /etc/ssl/certs/ca-certificates.crt -MaildirStore disroot-local +MaildirStore mail-local Subfolders Verbatim Path ~/.local/share/mail/ Inbox ~/.local/share/mail/INBOX Flatten . -Channel disroot-remote +Channel mail-remote Expunge Both -Master :disroot-remote: -Slave :disroot-local: +Master :mail-remote: +Slave :mail-local: Patterns * !"[Gmail]/All Mail" Create Both SyncState * diff --git a/dotfiles/neomutt/neomuttrc b/dotfiles/neomutt/neomuttrc index 5081a42..fd617c6 100644 --- a/dotfiles/neomutt/neomuttrc +++ b/dotfiles/neomutt/neomuttrc @@ -7,15 +7,14 @@ # |_| |_|\___|\___/|_| |_| |_|\__,_|\__|\__| -set my_user='lelgenio' -set my_host='disroot.org' -set my_pass=`pass show Disroot | head -n1` +set my_user='{{@@ username @@}}' +set my_host='{{@@ mail @@}}' +set my_pass=`pass show "{{@@ mail @@}}" | head -n1` # Main settings{{{ -set realname = "Leonardo da Rosa Eugenio" -set from = "lelgenio@disroot.org" -#alias me Leonardo da Rosa Eugenio +set realname = "{{@@ username @@}}" +set from = "{{@@ username @@}}@{{@@ mail @@}}" # Set MailDir set mbox_type = Maildir diff --git a/dotfiles/scripts/_get-pass b/dotfiles/scripts/_get-pass new file mode 100755 index 0000000..32dd8db --- /dev/null +++ b/dotfiles/scripts/_get-pass @@ -0,0 +1,3 @@ +#!/bin/sh + +pass "$@" | head -n1