system/modules/home-manager/programs/terminals/foot.nix

73 lines
2.4 KiB
Nix
Raw Permalink Normal View History

2024-04-24 01:03:36 +03:00
{ lib, pkgs, config, ... }:
let
cfg = config.local.programs.terminals.foot;
themeCfg = config.local.themes."${config.local.theme.name}";
color = col: builtins.substring 1 6 col;
in
{
options.local.programs.terminals.foot = with lib; {
enable = mkEnableOption "foot";
fontSize = mkOption {
type = types.number;
default = 11;
description = "Foot font size";
};
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs.unstable; [ foot ];
# See https://codeberg.org/dnkl/foot/src/branch/master/foot.ini
xdg.configFile."foot/foot.ini".text = lib.generators.toINIWithGlobalSection { } {
globalSection = {
pad = "5x5";
font = "monospace:size=${toString cfg.fontSize}";
};
sections = {
colors = lib.mapAttrs (k: color) {
background = themeCfg.window.background;
foreground = themeCfg.window.mainText;
regular0 = themeCfg.window.regular.color0;
regular1 = themeCfg.window.regular.color1;
regular2 = themeCfg.window.regular.color2;
regular3 = themeCfg.window.regular.color3;
regular4 = themeCfg.window.regular.color4;
regular5 = themeCfg.window.regular.color5;
regular6 = themeCfg.window.regular.color6;
regular7 = themeCfg.window.regular.color7;
bright0 = themeCfg.window.bold.color8;
bright1 = themeCfg.window.bold.color9;
bright2 = themeCfg.window.bold.color10;
bright3 = themeCfg.window.bold.color11;
bright4 = themeCfg.window.bold.color12;
bright5 = themeCfg.window.bold.color13;
bright6 = themeCfg.window.bold.color14;
bright7 = themeCfg.window.bold.color15;
dim0 = themeCfg.window.regular.color0;
dim1 = themeCfg.window.regular.color1;
dim2 = themeCfg.window.regular.color2;
dim3 = themeCfg.window.regular.color3;
dim4 = themeCfg.window.regular.color4;
dim5 = themeCfg.window.regular.color5;
dim6 = themeCfg.window.regular.color6;
dim7 = themeCfg.window.regular.color7;
"16" = themeCfg.window.extended.color16;
"17" = themeCfg.window.extended.color17;
"18" = themeCfg.window.extended.color18;
"19" = themeCfg.window.extended.color19;
selection-foreground = themeCfg.window.selectionText;
selection-background = themeCfg.window.selection;
};
};
};
};
}