From 6f08daf39db86debb2c0e815371ff0448f12fba0 Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Wed, 18 Nov 2020 09:54:42 +0100 Subject: [PATCH] Add mail/card/calendar --- dotfiles/.config/khal/config | 12 +++ dotfiles/.config/khard/khard.conf | 53 +++++++++++ dotfiles/.config/vdirsyncer/config | 64 +++++++++++++ dotfiles/.mutt/colorscheme | 146 +++++++++++++++++++++++++++++ dotfiles/.mutt/keybindings | 43 +++++++++ dotfiles/.mutt/muttrc | 56 +++++++++++ setup.sh | 19 +++- 7 files changed, 388 insertions(+), 5 deletions(-) create mode 100644 dotfiles/.config/khal/config create mode 100644 dotfiles/.config/khard/khard.conf create mode 100644 dotfiles/.config/vdirsyncer/config create mode 100644 dotfiles/.mutt/colorscheme create mode 100644 dotfiles/.mutt/keybindings create mode 100644 dotfiles/.mutt/muttrc diff --git a/dotfiles/.config/khal/config b/dotfiles/.config/khal/config new file mode 100644 index 0000000..e014222 --- /dev/null +++ b/dotfiles/.config/khal/config @@ -0,0 +1,12 @@ +[calendars] + +[[calendar_local]] +path = ~/.calendar/* +type = discover + +[locale] +timeformat = %H:%M +dateformat = %Y-%m-%d +longdateformat = %Y-%m-%d +datetimeformat = %Y-%m-%d %H:%M +longdatetimeformat = %Y-%m-%d %H:%M diff --git a/dotfiles/.config/khard/khard.conf b/dotfiles/.config/khard/khard.conf new file mode 100644 index 0000000..9e320ad --- /dev/null +++ b/dotfiles/.config/khard/khard.conf @@ -0,0 +1,53 @@ +# example configuration file for khard version > 0.14.0 +# place it under ~/.config/khard/khard.conf +# This file is parsed by the configobj library. The syntax is described at +# https://configobj.readthedocs.io/en/latest/configobj.html#the-config-file-format + +[addressbooks] +[[contacts]] +path = ~/.contacts/contacts/ + +[general] +debug = no +default_action = list +# These are either strings or comma seperated lists +editor = vim, -i, NONE +merge_editor = vimdiff + +[contact table] +# display names by first or last name: first_name / last_name / formatted_name +display = formatted_name +# group by address book: yes / no +group_by_addressbook = no +# reverse table ordering: yes / no +reverse = no +# append nicknames to name column: yes / no +show_nicknames = no +# show uid table column: yes / no +show_uids = yes +# sort by first or last name: first_name / last_name / formatted_name +sort = last_name +# localize dates: yes / no +localize_dates = yes +# set a comma separated list of preferred phone number types in descending priority +# or nothing for non-filtered alphabetical order +preferred_phone_number_type = pref, cell, home +# set a comma separated list of preferred email address types in descending priority +# or nothing for non-filtered alphabetical order +preferred_email_address_type = pref, work, home + +[vcard] +# extend contacts with your own private objects +# these objects are stored with a leading "X-" before the object name in the vcard files +# every object label may only contain letters, digits and the - character +# example: +# private_objects = Jabber, Skype, Twitter +# default: , (the empty list) +private_objects = Jabber, Skype, Twitter +# preferred vcard version: 3.0 / 4.0 +preferred_version = 3.0 +# Look into source vcf files to speed up search queries: yes / no +search_in_source_files = no +# skip unparsable vcard files: yes / no +skip_unparsable = no + diff --git a/dotfiles/.config/vdirsyncer/config b/dotfiles/.config/vdirsyncer/config new file mode 100644 index 0000000..df74183 --- /dev/null +++ b/dotfiles/.config/vdirsyncer/config @@ -0,0 +1,64 @@ +[general] +status_path = "~/.config/vdirsyncer/status/" + +#CardDav +# CARDDAV +[pair contacts] +# A `[pair ]` block defines two storages `a` and `b` that should be +# synchronized. The definition of these storages follows in `[storage ]` +# blocks. This is similar to accounts in OfflineIMAP. +a = "contacts_local" +b = "contacts_remote" + +# Synchronize all collections that can be found. +# You need to run `vdirsyncer discover` if new calendars/addressbooks are added +# on the server. + +collections = ["from a", "from b"] + +# Synchronize the "display name" property into a local file (~/.contacts/displayname). +metadata = ["displayname"] + +# To resolve a conflict the following values are possible: +# `null` - abort when collisions occur (default) +# `"a wins"` - assume a's items to be more up-to-date +# `"b wins"` - assume b's items to be more up-to-date +#conflict_resolution = null + +[storage contacts_local] +# A storage references actual data on a remote server or on the local disk. +# Similar to repositories in OfflineIMAP. +type = "filesystem" +path = "~/.contacts/" +fileext = ".vcf" + +[storage contacts_remote] +type = "carddav" +url = "https://matrix.mickenordin.se/remote.php/dav/contacts/micke/personal/" +username = "micke" +#Instead of inserting my plaintext password I fetch it using pass +password.fetch = ["command", "pass", "matrix.mickenordin.se/micke"] + +# CalDav +[pair calendar] +a = "calendar_local" +b = "calendar_remote" +collections = ["from a", "from b"] +metadata = ["displayname"] + +[storage calendar_local] +type = "filesystem" +path = "~/.calendar" +fileext = ".ics" + +[storage calendar_remote] +type = "caldav" +#Can be obtained from nextcloud +url = "https://matrix.mickenordin.se/remote.php/dav/calendars/micke/personal/" +username = "micke" +#Instead of inserting my plaintext password I fetch it using pass +password.fetch = ["command", "pass", "matrix.mickenordin.se/micke"] +#SSL certificate fingerprint +#verify_fingerprint = "FINGERPRINT" +#Verify ssl certificate. Set to false if it is self signed and not installed on local machine +verify = true diff --git a/dotfiles/.mutt/colorscheme b/dotfiles/.mutt/colorscheme new file mode 100644 index 0000000..bf42c42 --- /dev/null +++ b/dotfiles/.mutt/colorscheme @@ -0,0 +1,146 @@ +# vim: filetype=muttrc + +# custom body highlights ----------------------------------------------- +# highlight my name and other personally relevant strings +#color body color136 color234 "(ethan|schoonover)" +# custom index highlights ---------------------------------------------- +# messages which mention my name in the body +#color index color136 color234 "~b \"phil(_g|\!| gregory| gold)|pgregory\" !~N !~T !~F !~p !~P" +#color index J_cream color230 "~b \"phil(_g|\!| gregory| gold)|pgregory\" ~N !~T !~F !~p !~P" +#color index color136 color37 "~b \"phil(_g|\!| gregory| gold)|pgregory\" ~T !~F !~p !~P" +#color index color136 J_magent "~b \"phil(_g|\!| gregory| gold)|pgregory\" ~F !~p !~P" +## messages which are in reference to my mails +#color index J_magent color234 "~x \"(mithrandir|aragorn)\\.aperiodic\\.net|thorin\\.hillmgt\\.com\" !~N !~T !~F !~p !~P" +#color index J_magent color230 "~x \"(mithrandir|aragorn)\\.aperiodic\\.net|thorin\\.hillmgt\\.com\" ~N !~T !~F !~p !~P" +#color index J_magent color37 "~x \"(mithrandir|aragorn)\\.aperiodic\\.net|thorin\\.hillmgt\\.com\" ~T !~F !~p !~P" +#color index J_magent color160 "~x \"(mithrandir|aragorn)\\.aperiodic\\.net|thorin\\.hillmgt\\.com\" ~F !~p !~P" + +# for background in 16 color terminal, valid background colors include: +# base03, bg, black, any of the non brights + +# basic colors --------------------------------------------------------- +color normal color241 color234 +color error color160 color234 +color tilde color235 color234 +color message color37 color234 +color markers color160 color254 +color attachment color254 color234 +color search color61 color234 +#color status J_black J_status +color status color241 color235 +color indicator color234 color136 +color tree color136 color234 # arrow in threads + +# basic monocolor screen +mono bold bold +mono underline underline +mono indicator reverse +mono error bold + +# index ---------------------------------------------------------------- + +#color index color160 color234 "~D(!~p|~p)" # deleted +#color index color235 color234 ~F # flagged +#color index color166 color234 ~= # duplicate messages +#color index color240 color234 "~A!~N!~T!~p!~Q!~F!~D!~P" # the rest +#color index J_base color234 "~A~N!~T!~p!~Q!~F!~D" # the rest, new +color index color160 color234 "~A" # all messages +color index color166 color234 "~E" # expired messages +color index color33 color234 "~N" # new messages +color index color33 color234 "~O" # old messages +color index color61 color234 "~Q" # messages that have been replied to +color index color240 color234 "~R" # read messages +color index color33 color234 "~U" # unread messages +color index color33 color234 "~U~$" # unread, unreferenced messages +color index color241 color234 "~v" # messages part of a collapsed thread +color index color241 color234 "~P" # messages from me +color index color37 color234 "~p!~F" # messages to me +color index color37 color234 "~N~p!~F" # new messages to me +color index color37 color234 "~U~p!~F" # unread messages to me +color index color240 color234 "~R~p!~F" # messages to me +color index color160 color234 "~F" # flagged messages +color index color160 color234 "~F~p" # flagged messages to me +color index color160 color234 "~N~F" # new flagged messages +color index color160 color234 "~N~F~p" # new flagged messages to me +color index color160 color234 "~U~F~p" # new flagged messages to me +color index color235 color160 "~D" # deleted messages +color index color245 color234 "~v~(!~N)" # collapsed thread with no unread +color index color136 color234 "~v~(~N)" # collapsed thread with some unread +color index color64 color234 "~N~v~(~N)" # collapsed thread with unread parent +# statusbg used to indicated flagged when foreground color shows other status +# for collapsed thread +color index color160 color235 "~v~(~F)!~N" # collapsed thread with flagged, no unread +color index color136 color235 "~v~(~F~N)" # collapsed thread with some unread & flagged +color index color64 color235 "~N~v~(~F~N)" # collapsed thread with unread parent & flagged +color index color64 color235 "~N~v~(~F)" # collapsed thread with unread parent, no unread inside, but some flagged +color index color37 color235 "~v~(~p)" # collapsed thread with unread parent, no unread inside, some to me directly +color index color136 color160 "~v~(~D)" # thread with deleted (doesn't differentiate between all or partial) +#color index color136 color234 "~(~N)" # messages in threads with some unread +#color index color64 color234 "~S" # superseded messages +#color index color160 color234 "~T" # tagged messages +#color index color166 color160 "~=" # duplicated messages + +# message headers ------------------------------------------------------ + +#color header color240 color234 "^" +color hdrdefault color240 color234 +color header color241 color234 "^(From)" +color header color33 color234 "^(Subject)" + +# body ----------------------------------------------------------------- + +color quoted color33 color234 +color quoted1 color37 color234 +color quoted2 color136 color234 +color quoted3 color160 color234 +color quoted4 color166 color234 + +color signature color240 color234 +color bold color235 color234 +color underline color235 color234 +color normal color244 color234 +# +color body color245 color234 "[;:][-o][)/(|]" # emoticons +color body color245 color234 "[;:][)(|]" # emoticons +color body color245 color234 "[*]?((N)?ACK|CU|LOL|SCNR|BRB|BTW|CWYL|\ + |FWIW|vbg|GD&R|HTH|HTHBE|IMHO|IMNSHO|\ + |IRL|RTFM|ROTFL|ROFL|YMMV)[*]?" +color body color245 color234 "[ ][*][^*]*[*][ ]?" # more emoticon? +color body color245 color234 "[ ]?[*][^*]*[*][ ]" # more emoticon? + +## pgp + +color body color160 color234 "(BAD signature)" +color body color37 color234 "(Good signature)" +color body color234 color234 "^gpg: Good signature .*" +color body color241 color234 "^gpg: " +color body color241 color160 "^gpg: BAD signature from.*" +mono body bold "^gpg: Good signature" +mono body bold "^gpg: BAD signature from.*" + +# yes, an instance URL regex +color body color160 color234 "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]" +# and a heavy handed email regex +#color body J_magent color234 "((@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]),)*@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]):)?[0-9a-z_.+%$-]+@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\])" + +# Various smilies and the like +#color body color230 color234 "<[Gg]>" # +#color body color230 color234 "<[Bb][Gg]>" # +#color body color136 color234 " [;:]-*[})>{(<|]" # :-) etc... +# *bold* +#color body color33 color234 "(^|[[:space:][:punct:]])\\*[^*]+\\*([[:space:][:punct:]]|$)" +#mono body bold "(^|[[:space:][:punct:]])\\*[^*]+\\*([[:space:][:punct:]]|$)" +# _underline_ +#color body color33 color234 "(^|[[:space:][:punct:]])_[^_]+_([[:space:][:punct:]]|$)" +#mono body underline "(^|[[:space:][:punct:]])_[^_]+_([[:space:][:punct:]]|$)" +# /italic/ (Sometimes gets directory names) +#color body color33 color234 "(^|[[:space:][:punct:]])/[^/]+/([[:space:][:punct:]]|$)" +#mono body underline "(^|[[:space:][:punct:]])/[^/]+/([[:space:][:punct:]]|$)" + +# Border lines. +#color body color33 color234 "( *[-+=#*~_]){6,}" + +#folder-hook . "color status J_black J_status " +#folder-hook gmail/inbox "color status J_black color136 " +#folder-hook gmail/important "color status J_black color136 " + diff --git a/dotfiles/.mutt/keybindings b/dotfiles/.mutt/keybindings new file mode 100644 index 0000000..19fb701 --- /dev/null +++ b/dotfiles/.mutt/keybindings @@ -0,0 +1,43 @@ +#------------------------------------------------------------ +# Vi Key Bindings +#------------------------------------------------------------ + +# Moving around +bind attach,browser,index g noop +bind attach,browser,index gg first-entry +bind attach,browser,index G last-entry +bind pager g noop +bind pager gg top +bind pager G bottom +bind pager k previous-line +bind pager j next-line + +# Scrolling +bind attach,browser,pager,index \CF next-page +bind attach,browser,pager,index \CB previous-page +bind attach,browser,pager,index \Cu half-up +bind attach,browser,pager,index \Cd half-down +bind browser,pager \Ce next-line +bind browser,pager \Cy previous-line +bind index \Ce next-line +bind index \Cy previous-line + +bind pager,index d noop +bind pager,index dd delete-message + +# Sidebar +bind index,pager K sidebar-prev # Shift-P - Previous Mailbox +bind index,pager J sidebar-next # Shift-N - Next Mailbox +bind index,pager O sidebar-open # Shift-O - Open Highlighted Mailbox + +# Mail & Reply +bind index \Cm list-reply # Doesn't work currently + +# Threads +bind browser,pager,index N search-opposite +bind pager,index dT delete-thread +bind pager,index dt delete-subthread +bind pager,index gt next-thread +bind pager,index gT previous-thread +bind index za collapse-thread +bind index zA collapse-all # Missing :folddisable/foldenable diff --git a/dotfiles/.mutt/muttrc b/dotfiles/.mutt/muttrc new file mode 100644 index 0000000..07dc87e --- /dev/null +++ b/dotfiles/.mutt/muttrc @@ -0,0 +1,56 @@ +#source "gpg -d ~/.mutt/accounts/$MUTT_ACCOUNT |" +source ~/.mutt/keybindings +source ~/.mutt/colorscheme +folder-hook . 'push ' +set realname = 'Mikael Nordin' +set editor = 'vim' +set folder = 'imaps://imap.zoho.eu:993' +set spoolfile = '+INBOX' +set hostname = zoho.eu +set mail_check = 60 +set timeout = 300 +set imap_keepalive = 300 +set imap_pass = "`pass show zoho.eu/admin@mic.ke | head -1`" +set imap_user = 'admin@mic.ke' +set postponed = '+[INBOX]/Drafts' +set header_cache = ~/.mutt/cache/headers +set message_cachedir = ~/.mutt/cache/bodies +set certificate_file = ~/.mutt/certificates +set move = no +set sort = 'threads' +set sort_aux = 'reverse-last-date-received' +set auto_tag = yes +set record = '' +set quit = ask-yes +set include +set uncollapse_jump +set imap_check_subscribed +unset collapse_unread + +#SMTP +set record = +Sänt +set from = 'mik@elnord.in' +set use_from = yes +set smtp_pass = $imap_pass +set smtp_url=smtps://$imap_user@smtp.zoho.eu +set ssl_force_tls = yes + +ignore 'DKIM-Signature:' +ignore 'DomainKey-Signature:' +ignore 'Authentication-Results:' +hdr_order Date From To Cc +auto_view text/html application/pdf +alternative_order text/plain text/enriched text/html + +# Khard +set query_command = "khard email --parsable %s" +bind editor complete-query +bind editor ^T complete +macro index,pager A \ + "khard add-email" \ + "add the sender email address to khard" + +# Sidebar configuration +set sidebar_format = '%B%?F? [%F]?%* %?N?%N/?%S' +set sidebar_visible +set mail_check_stats diff --git a/setup.sh b/setup.sh index 115fedf..01570e5 100644 --- a/setup.sh +++ b/setup.sh @@ -40,21 +40,19 @@ sudo apt install \ meson \ mpv \ neovim \ + neomutt \ ninja-build \ nm-tray \ pass \ pavucontrol \ python3-pip \ qutebrowser \ - ranger \ ripgrep \ rsync \ scdoc \ sway \ - thunderbird \ unzip \ wayland-protocols \ - webext-keepassxc-browser \ wl-clipboard \ wlr-randr # Fix NextCloud stuff @@ -179,13 +177,22 @@ cd ncspot cargo build --release sudo cp target/release/ncspot /usr/local/bin/ +# Card/Cal +sudo pip3 install vdirsyncer khal khard +vdirsyncer discover contacts +vdirsyncer discover calendar +vdirsyncer sync + +# Firefox pass host app +curl -sSL github.com/passff/passff-host/releases/latest/download/install_host_app.sh | bash -s -- firefox + # dotfiles cd ${WORKDIR} rsync -a dotfiles/ ~/ # Background -cd ~/Pictures -wget https://www.publicdomainpictures.net/pictures/230000/velka/night-landscape-15010066769pV.jpg +sudo mkdir -p /usr/local/share/backgrounds +sudo wget https://www.publicdomainpictures.net/pictures/230000/velka/night-landscape-15010066769pV.jpg -O /usr/local/share/backgrounds/night-landscape.jpg # VictoMono font cd /tmp @@ -201,6 +208,8 @@ curl -L https://get.oh-my.fish | fish omf install agnoster chsh -s (which fish) +echo "Make sure you have you gpg-key imported and trusted" + echo "Follow this instruction if gnome-keyring gives you trouble: https://wiki.archlinux.org/index.php/GNOME/Keyring#Using_the_keyring_outside_GNOME" echo "Rebooting in 5 seconds" sleep 5s