This commit is contained in:
Leonardo Eugênio 2023-02-18 16:16:01 -03:00
parent b78fc81374
commit b545641c6e
3 changed files with 196 additions and 104 deletions

View file

@ -23,6 +23,7 @@ let
msmtp.enable = true; msmtp.enable = true;
notmuch.enable = true; notmuch.enable = true;
neomutt.enable = true; neomutt.enable = true;
neomutt.extraMailboxes = boxes;
}; };
in in
{ {
@ -54,6 +55,7 @@ in
passwordCommand = toString (pkgs.writeShellScript "get_pass" '' passwordCommand = toString (pkgs.writeShellScript "get_pass" ''
pass "Trabalho/wopus_email/leonardo@wopus.com.br" | head -n1 pass "Trabalho/wopus_email/leonardo@wopus.com.br" | head -n1
''); '');
folders.inbox = "INBOX";
} // defaultAccountSettings { boxes = [ "INBOX" ]; }; } // defaultAccountSettings { boxes = [ "INBOX" ]; };
}; };

View file

@ -1,107 +1,159 @@
{ pkgs, lib, ... }: { pkgs, lib, config, ... }:
let let
inherit (pkgs.uservars) key; inherit (pkgs.uservars) key;
inherit (lib) toUpper; inherit (lib) toUpper;
mkControlBind = key: ''"^${ key }"'';
mkAltBind = key: ''"\e${ key }"'';
mkDirectionBinds' = filter: modes: commands: map
(direction: lib.mkIf (lib.hasAttr direction commands) {
map = modes;
key = filter key.${direction};
action = commands.${direction};
}) [ "left" "down" "up" "right" ];
mkDirectionBinds = mkDirectionBinds' (x: x);
mkDirectionBindsControl = mkDirectionBinds' mkControlBind;
in in
{ {
programs.neomutt.enable = true; programs.neomutt.enable = true;
programs.neomutt.binds = [ programs.neomutt.sidebar.enable = false;
{ programs.neomutt.sort = "reverse-date";
map = [ "index" ]; programs.neomutt.binds =
key = key.left; (mkDirectionBindsControl [ "index" "pager" ] {
action = "noop"; up = "half-up";
} down = "half-down";
{ }) ++
map = [ "index" ]; (mkDirectionBindsControl [ "index" "pager" ] {
key = key.down; left = "sidebar-toggle-visible";
action = "next-entry"; down = "sidebar-next";
} up = "sidebar-prev";
{ right = "sidebar-open";
map = [ "index" ]; }) ++
key = key.up; (mkDirectionBinds [ "index" ] {
action = "previous-entry"; left = "noop";
} down = "next-entry";
{ up = "previous-entry";
map = [ "index" ]; right = "display-message";
key = key.right; }) ++
action = "display-message"; (mkDirectionBinds [ "pager" ] {
} left = "exit";
down = "next-line";
up = "previous-line";
right = "view-attachments";
}) ++
(mkDirectionBinds [ "attach" ] {
left = "exit";
down = "next-entry";
up = "previous-entry";
right = "view-mailcap";
}) ++ [
# {
# map = [ "index" ];
# key = key.left;
# action = "noop";
# }
# {
# map = [ "index" ];
# key = key.down;
# action = "next-entry";
# }
# {
# map = [ "index" ];
# key = key.up;
# action = "previous-entry";
# }
# {
# map = [ "index" ];
# key = key.right;
# action = "display-message";
# }
{ # {
map = [ "attach" ]; # map = [ "attach" ];
key = key.up; # key = key.left;
action = "previous-entry"; # action = "exit";
} # }
{ # {
map = [ "attach" ]; # map = [ "attach" ];
key = key.down; # key = key.down;
action = "next-entry"; # action = "next-entry";
} # }
{ # {
map = [ "attach" ]; # map = [ "attach" ];
key = key.left; # key = key.up;
action = "exit"; # action = "previous-entry";
} # }
{ # {
map = [ "attach" ]; # map = [ "attach" ];
key = key.right; # key = key.right;
action = "view-mailcap"; # action = "view-mailcap";
} # }
{
map = [ "pager" ]; # {
key = key.left; # map = [ "pager" ];
action = "exit"; # key = key.left;
} # action = "exit";
{ # }
map = [ "pager" ]; # {
key = key.down; # map = [ "pager" ];
action = "next-line"; # key = key.down;
} # action = "next-line";
{ # }
map = [ "pager" ]; # {
key = key.up; # map = [ "pager" ];
action = "previous-line"; # key = key.up;
} # action = "previous-line";
{ # }
map = [ "pager" ]; # {
key = key.right; # map = [ "pager" ];
action = "view-attachments"; # key = key.right;
} # action = "view-attachments";
{ # }
map = [ "index" "pager" "browser" ];
key = toUpper key.up; # {
action = "half-up"; # map = [ "index" "pager" "browser" ];
} # key = toUpper key.up;
{ # action = "half-up";
map = [ "index" "pager" "browser" ]; # }
key = toUpper key.down; # {
action = "half-down"; # map = [ "index" "pager" "browser" ];
} # key = toUpper key.down;
{ # action = "half-down";
map = [ "browser" ]; # }
key = key.left;
action = "goto-parent"; {
} map = [ "browser" ];
{ key = key.left;
map = [ "index" "pager" ]; action = "goto-parent";
key = "\\C${ key.down }"; }
action = "sidebar-next";
} # {
{ # map = [ "index" "pager" ];
map = [ "index" "pager" ]; # key = mkControlBind key.down;
key = "\\C${ key.up }"; # action = "sidebar-next";
action = "sidebar-prev"; # }
} # {
{ # map = [ "index" "pager" ];
map = [ "index" "pager" ]; # key = mkControlBind key.up;
key = "\\C${ key.right }"; # action = "sidebar-prev";
action = "sidebar-open"; # }
} # {
{ # map = [ "index" "pager" ];
map = [ "index" "pager" ]; # key = mkControlBind key.right;
key = "\\C${ key.left }"; # action = "sidebar-open";
action = "sidebar-toggle-visible"; # }
} # {
]; # map = [ "index" "pager" ];
programs.neomutt.extraConfig = lib.readFile ./neomuttrc; # key = mkControlBind key.left;
# action = "sidebar-toggle-visible";
# }
];
programs.neomutt.extraConfig = ''
source extra
'';
xdg.configFile."neomutt/extra".source = config.lib.file.mkOutOfStoreSymlink "/home/lelgenio/projects/nixos-config/user/neomutt/neomuttrc";
} }

View file

@ -31,21 +31,27 @@ set use_from = yes
# }}} # }}}
# General {{{ # General {{{
set use_threads = threads # set use_threads = threads
set sort = reverse-last-date set sort = threads
set sort_aux = last-date set sort_aux = reverse-last-date
set mail_check_stats = yes set mail_check_stats = yes
set mail_check_stats_interval = 10 set mail_check_stats_interval = 10
set mark_old = no # Unread mail stay unread until read set mark_old = no # Unread mail stay unread until read
set mailcap_path = ~/.config/neomutt/mailcap set mailcap_path = ~/.config/neomutt/mailcap
auto_view text/html # automatically show html auto_view text/html # automatically show html
auto_view application/pgp-encrypted auto_view application/pgp-encrypted
alternative_order text/plain text/enriched text/html alternative_order text/plain text/enriched text/html
set query_command= "khard email --parsable %s" set query_command= "khard email --parsable %s"
# unmailboxes *
mailboxes 'notmuch://?query=tag:inbox'
set spoolfile = 'notmuch://?query=tag:inbox'
# }}} # }}}
# General rebindings{{{ # General rebindings{{{
@ -115,7 +121,7 @@ set sidebar_visible = yes
set sidebar_width = 20 set sidebar_width = 20
set sidebar_short_path = yes set sidebar_short_path = yes
set sidebar_next_new_wrap = yes set sidebar_next_new_wrap = yes
# set mail_check_stats set mail_check_stats
set sidebar_format = '%B%?F? [%F]?%* %?N?%N/? %?S?%S?' set sidebar_format = '%B%?F? [%F]?%* %?N?%N/? %?S?%S?'
@ -131,11 +137,43 @@ set markers = no
set date_format="%m/%d %H:%M" set date_format="%m/%d %H:%M"
set index_format="%3C %zs %?X?A& ? %D %-15.15F %s" set index_format="%3C %zs %?X?A& ? %D %-15.15F %s"
set display_filter = '_mutt_escape-html-chars' # set display_filter = '_mutt_escape-html-chars'
#}}} #}}}
# colors{{{ # colors{{{
# General
color status black default
color indicator brightwhite red
# Messages
color index default default '.*'
color index_number black default
color index_author red default '.*'
color index_subject green default '.*'
# New messages
color index brightgreen default "~N|~O"
color index_author brightred default "~N"
color index_subject brightcyan default "~N"
# Sidebar
color sidebar_new green default
color sidebar_highlight default green
color sidebar_indicator brightwhite red
color sidebar_divider black default
# Header - information for any open email
color header default default "^(Date)"
color header red default "^(From)"
color header green default "^(Subject)"
color header brightwhite default "^(CC|BCC)"
# Content - Body of open email
color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses
color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL
color attachment default black
# # General # # General
# color status black default # color status black default
# color indicator brightwhite {{@@ accent_color_name @@}} # color indicator brightwhite {{@@ accent_color_name @@}}