feat(emacs): add mailto and org-protocol handlers for Emacs
This commit is contained in:
parent
664883a40d
commit
7c510e5dba
@ -3,7 +3,7 @@
|
|||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: with lib; let
|
||||||
emacsDefaultPackage = with pkgs; ((emacsPackagesFor emacsNativeComp).emacsWithPackages (
|
emacsDefaultPackage = with pkgs; ((emacsPackagesFor emacsNativeComp).emacsWithPackages (
|
||||||
epkgs: [
|
epkgs: [
|
||||||
epkgs.vterm
|
epkgs.vterm
|
||||||
@ -14,23 +14,45 @@
|
|||||||
cfg = config.modules.emacs;
|
cfg = config.modules.emacs;
|
||||||
in {
|
in {
|
||||||
options.modules.emacs = {
|
options.modules.emacs = {
|
||||||
enable = lib.mkEnableOption "enables Emacs";
|
enable = mkEnableOption "enables Emacs";
|
||||||
package = lib.mkOption {
|
package = mkOption {
|
||||||
type = lib.types.package;
|
type = types.package;
|
||||||
default = emacsDefaultPackage;
|
default = emacsDefaultPackage;
|
||||||
};
|
};
|
||||||
service = lib.mkEnableOption "enables Emacs service";
|
service = mkEnableOption "enables Emacs service";
|
||||||
|
mu4eMime = mkEnableOption "Enables mu4e to handle mailto scheme";
|
||||||
|
org-protocol = mkEnableOption "Enables org-protocol";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
programs.emacs = lib.mkIf cfg.enable {
|
programs.emacs = mkIf cfg.enable {
|
||||||
enable = true;
|
enable = true;
|
||||||
inherit (cfg) package;
|
inherit (cfg) package;
|
||||||
};
|
};
|
||||||
services.emacs = lib.mkIf cfg.service {
|
services.emacs = mkIf cfg.service {
|
||||||
enable = true;
|
enable = true;
|
||||||
inherit (cfg) package;
|
inherit (cfg) package;
|
||||||
startWithUserSession = "graphical";
|
startWithUserSession = "graphical";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xdg.desktopEntries.mu4e = mkIf cfg.mu4eMime {
|
||||||
|
name = "mu4e";
|
||||||
|
genericName = "mu4e";
|
||||||
|
comment = "Maildir Utils for Emacs";
|
||||||
|
mimeType = ["x-scheme-handler/mailto"];
|
||||||
|
noDisplay = true;
|
||||||
|
exec = "${cfg.package}/bin/emacsclient -c -n -a ${cfg.package}/bin/emacs -e \"(browse-url-mail \\\"\\$*\\\")\"";
|
||||||
|
terminal = false;
|
||||||
|
categories = ["Network" "Email" "TextEditor" "Utility"];
|
||||||
|
};
|
||||||
|
|
||||||
|
xdg.desktopEntries.org-protocol = mkIf cfg.org-protocol {
|
||||||
|
name = "org-protocol";
|
||||||
|
exec = "${cfg.package}/bin/emacsclient -c -n -a ${cfg.package}/bin/emacs %u";
|
||||||
|
terminal = false;
|
||||||
|
noDisplay = true;
|
||||||
|
categories = ["System"];
|
||||||
|
mimeType = ["x-scheme-handler/org-protocol"];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,8 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
service = true;
|
service = true;
|
||||||
package = emacsPkg;
|
package = emacsPkg;
|
||||||
|
mu4eMime = true;
|
||||||
|
org-protocol = true;
|
||||||
};
|
};
|
||||||
shell.starship.jjIntegration = true;
|
shell.starship.jjIntegration = true;
|
||||||
bat.extras = true;
|
bat.extras = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user