diff options
Diffstat (limited to 'modules/user-interface.nix')
-rw-r--r-- | modules/user-interface.nix | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/modules/user-interface.nix b/modules/user-interface.nix index 39964971..b0d66516 100644 --- a/modules/user-interface.nix +++ b/modules/user-interface.nix @@ -4,6 +4,32 @@ let emacsPackage = import ../packages/emacs.nix { pkgs = pkgs.unstable; }; + editorScript = pkgs.writeScriptBin "edit" '' + #!${pkgs.runtimeShell} + if [ -z "$1" ]; then + exec ${emacsPackage}/bin/emacsclient --create-frame --alternate-editor ${emacsPackage}/bin/emacs + else + exec ${emacsPackage}/bin/emacsclient --alternate-editor ${emacsPackage}/bin/emacs "$@" + fi + ''; + desktopApplicationFile = pkgs.writeTextFile { + name = "emacsclient.desktop"; + destination = "/share/applications/emacsclient.desktop"; + text = '' + [Desktop Entry] + Name=Emacsclient + GenericName=Text Editor + Comment=Edit text + MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; + Exec=emacseditor %F + Icon=emacs + Type=Application + Terminal=false + Categories=Development;TextEditor; + StartupWMClass=Emacs + Keywords=Text;Editor; + ''; + }; in { programs.browserpass.enable = true; documentation.info.enable = true; @@ -58,10 +84,11 @@ in }; }; - services.emacs = { - enable = true; - defaultEditor = true; - package = emacsPackage; + environment.variables = { + # This is required so that GTK applications launched from Emacs + # get properly themed: + GTK_DATA_PREFIX = "${config.system.path}"; + EDITOR = lib.mkOverride 900 "${editorScript}/bin/edit"; }; services.redshift = { |