about summary refs log tree commit diff
path: root/home/profiles/development
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2023-08-28 19:59:27 +0900
committersefidel <contact@sefidel.net>2023-09-01 16:18:04 +0900
commit41bed345881c5866367e62ae5cf97c5259686ea0 (patch)
tree02f4aba4cc1f06c8e7298ea83271a764c26b0740 /home/profiles/development
parent164075ea0ed451b1ccb094921a1d3383816dee1e (diff)
downloadnixrc-41bed345881c5866367e62ae5cf97c5259686ea0.tar.gz
nixrc-41bed345881c5866367e62ae5cf97c5259686ea0.zip
feat(home/development): use custom terminfo for emacs on foot
Diffstat (limited to 'home/profiles/development')
-rw-r--r--home/profiles/development/default.nix28
1 files changed, 25 insertions, 3 deletions
diff --git a/home/profiles/development/default.nix b/home/profiles/development/default.nix
index c47040e..846a593 100644
--- a/home/profiles/development/default.nix
+++ b/home/profiles/development/default.nix
@@ -186,12 +186,34 @@ in
       client.enable = true;
       socketActivation.enable = true;
     };
-    programs.emacs.enable = true;
-    programs.zshell.aliases = {
-      e = "emacsclient -ta emacs";
+    programs.emacs = {
+      enable = true;
+      package = pkgs.emacs29-pgtk;
     };
 
+    home.activation.installFootEmacsTerminfo = ''
+      ${pkgs.ncurses}/bin/tic -x -o $HOME/.terminfo ${
+        pkgs.fetchurl {
+          url =
+            "https://gist.githubusercontent.com/sefidel/5f7f46783ad527ada98caa13e32efd42/raw/509375cc7bff269bb3b906fd417ed3d51b4a1cc5/foot-emacs.src";
+          sha256 = "sha256-aR/C40NWbrwYRIAvaRL/6gUAcP7xokChOVJIbyDXAwI=";
+        }
+      }
+    '';
+
     home.packages = [
+      # Launchable graphical emacsclient in bemenu
+      (pkgs.writeShellScriptBin "ec" "emacsclient -cna emacs $@")
+      # Emacsclient with 24bit colours fix for foot
+      (pkgs.writeShellScriptBin "e" ''
+       if [[ "$TERM" == "foot" ]]; then
+          eprefix="TERM=foot-emacs"
+        elif [[ "$TERM" == "foot-direct" ]]; then
+          eprefix="TERM=foot-direct-emacs"
+        fi
+        eval "$eprefix emacsclient -ta emacs $@"
+      '')
+
       pkgs.bfg-repo-cleaner
       pkgs.diffoscopeMinimal
       pkgs.colmena