main
 1{
 2  den,
 3  lib,
 4  ...
 5}: {
 6  den.aspects.desktop.terminal.ghostty = {
 7    includes = [den.aspects.desktop.terminal];
 8
 9    homeManager = {
10      host,
11      user,
12      ...
13    }: let
14      fontsCfg = host.settings.desktop.style.fonts;
15    in {
16      xdg.terminal-exec.settings.default =
17        if (user.system.settings.desktop.terminal.default == "ghostty")
18        then lib.mkBefore ["com.mitchellh.ghostty.desktop"]
19        else lib.mkAfter ["com.mitchellh.ghostty.desktop"];
20
21      programs.ghostty = {
22        enable = true;
23        enableBashIntegration = true;
24        enableFishIntegration = true;
25
26        settings = {
27          font-family = lib.concatMap (f: f.name) (fontsCfg.monospace.name ++ fontsCfg.emoji.name);
28          font-size = fontsCfg.sizes.terminal;
29          window-padding-x = 5;
30          window-padding-y = 5;
31          window-padding-balance = true;
32        };
33      };
34    };
35  };
36
37  den.aspects.desktop.terminal.ghostty.themes = {
38    catppuccin = {
39      homeManager = {pkgs, ...}: {
40        xdg.configFile."ghostty/themes/catppuccin-latte.conf".source = pkgs.fetchurl {
41          pname = "ghostty-theme-catppuccin-latte.conf";
42          url = "https://github.com/catppuccin/ghostty/raw/5a58926563ddacbde4a12b4a347464c2c6945393/themes/catppuccin-latte.conf";
43          hash = "sha256-S+V2DXWakPAHpwyhgZrgmrHbDIScRi8/O0RZD1EQrvU=";
44        };
45        xdg.configFile."ghostty/themes/catppuccin-mocha.conf".source = pkgs.fetchurl {
46          pname = "ghostty-theme-catppuccin-mocha.conf";
47          url = "https://github.com/catppuccin/ghostty/raw/5a58926563ddacbde4a12b4a347464c2c6945393/themes/catppuccin-mocha.conf";
48          hash = "sha256-/NwPBF9o16h5f/Xx06dniLwX3VO0Z8Bbe9Zb0UoBMx4=";
49        };
50
51        programs.ghostty = {
52          settings = {
53            theme = "light:catppuccin-latte.conf,dark:catppuccin-mocha.conf";
54          };
55        };
56      };
57    };
58  };
59}