diff --git a/hosts/morty/home-config.nix b/hosts/morty/home-config.nix index ed063e5..17453be 100644 --- a/hosts/morty/home-config.nix +++ b/hosts/morty/home-config.nix @@ -3,11 +3,10 @@ email = { enable = true; accountConfigs = { - a = inputs.nix-private.mail.xiemeart; - b = inputs.nix-private.mail.ephase; - c = inputs.nix-private.mail.ubordeaux; + ubordeaux = inputs.nix-private.mail.ubordeaux; + xiemeart = inputs.nix-private.mail.xiemeart; }; - primary = "a"; + primary = "xiemeart"; }; application = { gnupg = { diff --git a/modules/home-manager/accounts/email/default.nix b/modules/home-manager/accounts/email/default.nix index 0f9b089..af9d1b1 100644 --- a/modules/home-manager/accounts/email/default.nix +++ b/modules/home-manager/accounts/email/default.nix @@ -35,14 +35,8 @@ in defaultSetting = { mbsync = { enable = true; - create = "both"; + create = "maildir"; expunge = "both"; - remove = "both"; - patterns = [ - "*" - # Trash is a pain in the ass to manage with notmuch - "!Trash" - ]; }; msmtp = { enable = true; @@ -81,7 +75,7 @@ in extraConfig = '' [FolderNameFilter] folder_explicit_list = archives - folder_transforms = archives:archived + folder_transforms = archives:archive maildir_separator = / [MailMover] folders = ${lib.concatStringsSep " " (lib.unique (lib.mapAttrsToList (n: v: "${n}") mailMoverRules))} @@ -91,8 +85,8 @@ in [KillThreadsFilter] [ArchiveSentMailsFilter] sent_tag = sent - ${lib.concatImapStrings (p: e: "\n\n[Filter.${toString p}]\n ${lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: "${n} = ${v}") e)}") mailFilterRules} [InboxFilter] + ${lib.concatImapStrings (p: e: "\n\n[Filter.${toString p}]\n ${lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: "${n} = ${v}") e)}") mailFilterRules} ''; }; programs.neomutt = let @@ -103,14 +97,12 @@ in key = ""; }) ( lib.attrsets.mapAttrsToList ( - n: c: - { "action" = "source ~/.config/neomutt/${n}Unread:${c.config.address}";} - ) cfg.accountConfigs); + n: _: + { "action" = "source ~/.config/neomutt/${n}=InboxUnread";} + ) inputs.nix-private.mail); in { enable = true; unmailboxes = true; - changeFolderWhenSourcingAccount = true; - sourcePrimaryAccount = false; editor = "nvim +/^$/ +':nohl'"; settings = { sleep_time = "1"; @@ -138,37 +130,24 @@ in my_pager = "'  %F |  %s %* Pos: %P '"; compose_format = "' COMPOSE  %a | 󰉉 %l'"; query_command = "'${pkgs.khard}/bin/khard email --parsable --search-in-source-files %s'"; - virtual_spoolfile = "yes"; - mail_check_stats = "yes"; - mh_purge = "yes"; - mailcap_path= "${config.xdg.configHome}/neomutt/mailcap"; }; extraConfig = '' ${(builtins.readFile ./files/theme.muttrc)} charset-hook ^iso-8859-1$ cp1252 ignore * - unignore from date subject to cc bcc tags user-agent x-mailer - - # Attachment auto_view text/x-vcard text/html text/enriched text/calendar alternative_order text/html text/enriched text/plain text/* - - tag-transforms "attachment" "󰁦" \ + tag-transforms "attachment" "󰁦" \ "encrypted" "󱧈" \ "signed" "󱅞" \ "unread" "" \ "replied" "" - tag-formats "attachment" "GA" \ - "encrypted" "GE" \ - "signed" "GS" \ - "unread" "GU" \ - "replied" "GR" - - ${lib.concatStrings (lib.attrsets.mapAttrsToList ( _: v: if lib.hasAttrByPath [ "neomuttHooks" ] v then v.neomuttHooks else "" ) cfg.accountConfigs)} - # manually source first account instead of use home-manager parameter because - # of $my_pager expansion does not work as this variable is not already set - source ${config.xdg.configHome}/neomutt/${cfg.primary} + tag-formats "attachment" "GA" \ + "encrypted" "GE" \ + "signed" "GS" \ + "unread" "GU" \ + "replied" "GR" ''; binds = [ { map = [ "attach" "browser" "index" "pager" ]; key = "g"; action = "noop"; } @@ -192,8 +171,12 @@ in { map = [ "index" ]; key = "\\Ce"; action = "next-line";} { map = [ "index" ]; key = "\\Cy"; action = "previous-line";} + # Delete + { map = [ "pager" "index" ]; key = "d "; action = "noop";} + { map = [ "pager" "index" ]; key = "dd "; action = "delete-message";} + # Reply - { map =[ "pager" "index" ]; key = "R"; action = "group-reply";} + { map =[ "pager" "index" ]; key = "R "; action = "group-reply";} # sidebar { map = [ "index" "pager" ]; key = ""; action = "sidebar-toggle-visible";} @@ -212,15 +195,17 @@ in { map = [ "index" "pager" ]; key = "\\eX"; action = "vfolder-from-query";} # generate virtual folder from query with time window + { map = [ "index" ]; key = "<"; action = "vfolder-window-backward";} + { map = [ "index" ]; key = ">"; action = "vfolder-window-forward";} { map = [ "index" "pager" ]; key = "\\CD"; action = "modify-tags";} # Editor { map = [ "editor" ]; key = ""; action = "complete-query";} - { map = [ "editor" ]; key = "^T"; action = "complete";} + { map = [ "editor" ]; key = "^T "; action = "complete";} ]; macros = [ - { map = [ "pager" ]; key = "\\CB"; action = "${pkgs.urlscan}/bin/urlscan -d -c --color true"; } + #Define some macros here ] ++ accountMacros; }; programs.mbsync = { @@ -241,12 +226,5 @@ in programs.msmtp = { enable = true; }; - home.file."${config.xdg.configHome}/urlscan/config.json".source = ./files/urlscan.config.json; - xdg.configFile."neomutt/mailcap".text = '' - text/html; ${pkgs.xdg-utils}/bin/xdg-open %s; nametemplate=%html - text/html; ${pkgs.w3m}/bin/w3m -I %{charset} -cols 90 -T text/html %s; copiousoutput - application/pdf; ${pkgs.xdg-utils}/bin/xdg-open %s & - image/*; ${pkgs.xdg-utils}/bin/xdg-open %s & - ''; }; } diff --git a/modules/home-manager/accounts/email/files/theme.muttrc b/modules/home-manager/accounts/email/files/theme.muttrc index e3e0baa..e7ea68c 100644 --- a/modules/home-manager/accounts/email/files/theme.muttrc +++ b/modules/home-manager/accounts/email/files/theme.muttrc @@ -1,4 +1,5 @@ # vi: ft=muttrc +# base16-mutt: base16-shell support for mutt ## Base color normal color20 default # softer, bold @@ -29,7 +30,7 @@ color index_author color20 default color index_date color20 default color index_flags color20 default color index_tag color20 default -color index_tags italic color08 default +color index_tags color20 default color index_author italic color06 default "~g !~V" color index_author color04 default "~g ~V" @@ -47,16 +48,14 @@ color index_date italic color00 color06 "~T" color index_tags italic color00 color06 "~T" color index_tag italic color00 color06 "~T" -color index_subject color01 color18 "~D" # deleted messages - color index_subject italic bold color00 default "~T (~U|~N|~O)" ## Weak -color index color01 default "~v~(~F)" # collapsed thread with flagged inside +color index color01 default "~v~(~F)" # collapsed thread with flagged inside # Selection color index italic color00 color06 "~T" # tagged messages -color index default color18 "~D" # deleted messages +color index color01 color18 "~D" # deleted messages ### Message Headers ---------------------------------------------------- @@ -78,26 +77,22 @@ color header color06 color00 "((@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0- # When possible, these regular expressions attempt to match http://spec.commonmark.org/ ## Weak # ~~~ Horizontal rules ~~~ -color body color08 default "([[:space:]]*[-+=#*~_]){3,}[[:space:]]*" - +color body color08 color00 "([[:space:]]*[-+=#*~_]){3,}[[:space:]]*" +## Strong # *Bold* span -color body brightcolor03 default "(^|[[:space:][:punct:]])\\*[^*]+\\*([[:space:][:punct:]]|$)" - +color body brightcolor03 color00 "(^|[[:space:][:punct:]])\\*[^*]+\\*([[:space:][:punct:]]|$)" # _Underline_ span -color body underline color20 default "(^|[[:space:][:punct:]])_[^_]+_([[:space:][:punct:]]|$)" - +color body color05 color00 "(^|[[:space:][:punct:]])_[^_]+_([[:space:][:punct:]]|$)" # /Italic/ span (Sometimes gets directory names) -color body italic color20 default "(^|[[:space:][:punct:]])/[^/]+/([[:space:][:punct:]]|$)" - +color body color05 color00 "(^|[[:space:][:punct:]])/[^/]+/([[:space:][:punct:]]|$)" # ATX headers -color body color04 default "^[[:space:]]{0,3}#+[[:space:]].*$" - +color body color04 color00 "^[[:space:]]{0,3}#+[[:space:]].*$" +## Highlight # `Code` span -color body color05 default "(^|[[:space:][:punct:]])\`[^\`]+\`([[:space:][:punct:]]|$)" - -color body bold color01 default "^(\\*[[:space:]])" - -## URI +color body color02 color00 "(^|[[:space:][:punct:]])\`[^\`]+\`([[:space:][:punct:]]|$)" +# Indented code block +color body color02 color00 "^[[:space:]]{4,}.*$" +# URLs color body italic color04 color00 "([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<>\"]" # Email addresses color body color06 color00 "((@(([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]\\])" diff --git a/modules/home-manager/accounts/email/files/urlscan.config.json b/modules/home-manager/accounts/email/files/urlscan.config.json deleted file mode 100644 index 961c5ce..0000000 --- a/modules/home-manager/accounts/email/files/urlscan.config.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "palettes": { - "default": [ - [ "header", "white", "dark blue", "standout", "#d8d8d8", "#383838" ], - [ "footer", "white", "dark red", "standout", "#d8d8d8", "#383838" ], - [ "search", "white", "dark green", "standout", "#282828", "#f7ca88" ], - [ "msgtext", "", "", "", "", "" ], - [ "msgtext:ellipses", "light gray", "black", "bold", "#f7ca88", "#383838" ], - [ "urlref:number:braces", "light gray", "black", "bold", "#f8f8f8", "#383838"], - [ "urlref:number","yellow", "black","bold", "#f7ca88", "#383838" ], - [ "urlref:url", "white", "black", "italics", "#7cafc2", "#181818" ], - [ "url:sel", "white", "dark blue", "underline", "#7cafc2", "#383838" ] - ] - - }, - "keys": { - "/": "search_key", - "0": "digits", - "1": "digits", - "2": "digits", - "3": "digits", - "4": "digits", - "5": "digits", - "6": "digits", - "7": "digits", - "8": "digits", - "9": "digits", - "a": "add_url", - "C": "clipboard", - "c": "context", - "ctrl l": "clear_screen", - "ctrl f": "page_down", - "ctrl b": "page_up", - "d": "del_url", - "f1": "help_menu", - "G": "bottom", - "g": "top", - "j": "down", - "k": "up", - "J": "next", - "K": "previous", - "P": "clipboard_pri", - "l": "link_handler", - "o": "open_queue", - "O": "open_queue_win", - "p": "palette", - "Q": "quit", - "q": "quit", - "R": "reverse", - "S": "all_shorten", - "s": "shorten", - "u": "all_escape" - } -}