Make aerc work
- Add keybinds so that we can use it
- Add an overlay to let us run aerc's view calendar python script
diff --git a/modules/email.nix b/modules/email.nix
index ece4c90..79de03e 100644
--- a/modules/email.nix
+++ b/modules/email.nix
@@ -4,6 +4,7 @@
username,
home-manager-unstable,
home,
+ lib,
...
}: {
home = {
@@ -80,6 +81,22 @@
programs.aerc = {
enable = true;
extraConfig.general.unsafe-accounts-conf = true;
+ extraBinds = lib.pipe ./email/aerc-default-binds.toml [builtins.readFile builtins.fromTOML];
+ extraConfig.filters = let
+ defaultFilters = lib.pipe "${pkgs.aerc}/share/aerc/filters" [
+ builtins.readDir
+ builtins.attrNames
+ (builtins.map (f: {
+ name = f;
+ value = "${pkgs.aerc}/share/aerc/filters/${f}";
+ }))
+ builtins.listToAttrs
+ ];
+ in with defaultFilters; {
+ "text/plain" = colorize;
+ "text/calendar" = defaultFilters."show-ics-details.py";
+ "text/html" = html;
+ };
};
home.packages = with pkgs; [lynx];
home.file.".mailcap".text = ''
diff --git a/modules/email/aerc-default-binds.toml b/modules/email/aerc-default-binds.toml
new file mode 100644
index 0000000..17736b2
--- /dev/null
+++ b/modules/email/aerc-default-binds.toml
@@ -0,0 +1,99 @@
+# Binds are of the form <key sequence> = "<command to run>"
+# To use '=' in a key sequence, substitute it with "Eq": "<Ctrl+Eq>"
+# If you wish to bind #, you can wrap the key sequence in quotes: "#" = "quit"
+["global"]
+"<C-p>" = ":prev-tab<Enter>"
+"<C-n>" = ":next-tab<Enter>"
+"<C-t>" = ":term<Enter>"
+
+["messages"]
+"q" = ":quit<Enter>"
+
+"j" = ":next<Enter>"
+"<Down>" = ":next<Enter>"
+"<C-d>" = ":next 50%<Enter>"
+"<C-f>" = ":next 100%<Enter>"
+"<PgDn>" = ":next -s 100%<Enter>"
+
+"k" = ":prev<Enter>"
+"<Up>" = ":prev<Enter>"
+"<C-u>" = ":prev 50%<Enter>"
+"<C-b>" = ":prev 100%<Enter>"
+"<PgUp>" = ":prev -s 100%<Enter>"
+"g" = ":select 0<Enter>"
+"G" = ":select -1<Enter>"
+
+"J" = ":next-folder<Enter>"
+"K" = ":prev-folder<Enter>"
+
+"<Enter>" = ":view<Enter>"
+"d" = ":confirm 'Really delete this message?' ':delete-message<Enter>'<Enter>"
+"D" = ":delete<Enter>"
+"A" = ":archive flat<Enter>"
+
+"C" = ":compose<Enter>"
+
+"rr" = ":reply -a<Enter>"
+"rq" = ":reply -aq<Enter>"
+"Rr" = ":reply<Enter>"
+"Rq" = ":reply -q<Enter>"
+
+"c" = ":cf<space>"
+"$" = ":term<space>"
+"!" = ":term<space>"
+"|" = ":pipe<space>"
+
+"/" = ":search<space>"
+"n" = ":next-result<Enter>"
+"N" = ":prev-result<Enter>"
+
+["view"]
+"q" = ":close<Enter>"
+"|" = ":pipe<space>"
+"D" = ":delete<Enter>"
+"S" = ":save<space>"
+"A" = ":archive flat<Enter>"
+
+"f" = ":forward<Enter>"
+"rr" = ":reply -a<Enter>"
+"rq" = ":reply -aq<Enter>"
+"Rr" = ":reply<Enter>"
+"Rq" = ":reply -q<Enter>"
+
+"H" = ":toggle-headers<Enter>"
+"<C-k>" = ":prev-part<Enter>"
+"<C-j>" = ":next-part<Enter>"
+"J" = ":next<Enter>"
+"K" = ":prev<Enter>"
+
+["compose"]
+# Keybindings used when the embedded terminal is not selected in the compose
+# view
+"$ex" = "<C-x>"
+"<C-k>" = ":prev-field<Enter>"
+"<C-j>" = ":next-field<Enter>"
+"<tab>" = ":next-field<Enter>"
+
+["compose::editor"]
+# Keybindings used when the embedded terminal is selected in the compose view
+"$noinherit" = "true"
+"$ex" = "<semicolon>"
+"<C-k>" = ":prev-field<Enter>"
+"<C-j>" = ":next-field<Enter>"
+"<C-p>" = ":prev-tab<Enter>"
+"<C-n>" = ":next-tab<Enter>"
+
+["compose::review"]
+# Keybindings used when reviewing a message to be sent
+"y" = ":send<Enter>"
+"n" = ":abort<Enter>"
+"q" = ":abort<Enter>"
+"e" = ":edit<Enter>"
+"a" = ":attach<Enter>"
+
+["terminal"]
+"$noinherit" = "true"
+"$ex" = "<semicolon>"
+
+"<C-p>" = ":prev-tab<Enter>"
+"<C-n>" = ":next-tab<Enter>"
diff --git a/overlays/aerc.nix b/overlays/aerc.nix
new file mode 100644
index 0000000..6b3280c
--- /dev/null
+++ b/overlays/aerc.nix
@@ -0,0 +1,12 @@
+lib: final: prev: {
+ aerc = prev.aerc.overrideAttrs (prevAttrs: rec {
+ buildInputs = prevAttrs.buildInputs ++ [final.gawk];
+ pythonPath = prevAttrs.pythonPath ++ [final.python3.pkgs.vobject];
+ postFixup =
+ prevAttrs.postFixup
+ + ''
+ wrapProgram $out/share/aerc/filters/show-ics-details.py --prefix \
+ PYTHONPATH : ${final.python3.pkgs.makePythonPath pythonPath}
+ '';
+ });
+}