Generic progress
This commit is contained in:
1 parent
dd327a977a
commit
4f49ea8383
15 files changed
+173
-31
No files matched your search
@@ -3,6 +3,19 @@
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.fontconfig;
|
||||
|
||||
aliasConfig = font: ''
|
||||
<alias>
|
||||
<family>${font.name}</family>
|
||||
|
||||
<prefer>
|
||||
<family>${font.name}</family>
|
||||
${concatStrings (map (font: " <family>${font}</family>\n") font.fallbackFonts)}
|
||||
</prefer>
|
||||
</alias>
|
||||
'';
|
||||
|
||||
configContent = concatStrings (map (font: aliasConfig config.theming.fonts.pkgs.${font}) config.theming.fonts.installed);
|
||||
in {
|
||||
options.modules.fontconfig = {
|
||||
enable = mkEnableOption "fontconfig";
|
||||
@@ -27,5 +40,18 @@ in {
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
home.file.".config/fontconfig/conf.d/20-family-fallbacks.conf" = {
|
||||
enable = true;
|
||||
|
||||
text = ''
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
|
||||
<fontconfig>
|
||||
|
||||
${configContent}
|
||||
</fontconfig>
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -73,7 +73,8 @@ let
|
||||
}) enabledFonts));
|
||||
|
||||
# Convert set of fonts to list of packages
|
||||
fontPackageList = map (font: cfg.fonts.pkgs.${font.name}.package) (attrsToList fontPackages);
|
||||
fontNameList = map (font: font.name) (attrsToList fontPackages);
|
||||
fontPackageList = map (font: cfg.fonts.pkgs.${font}.package) fontNameList;
|
||||
in {
|
||||
imports = [
|
||||
# Import all themes
|
||||
@@ -81,12 +82,6 @@ in {
|
||||
./themes/catppuccin.nix
|
||||
];
|
||||
|
||||
options.testing.test = mkOption {
|
||||
type = types.anything;
|
||||
default = traced;
|
||||
description = "Wowzah";
|
||||
};
|
||||
|
||||
options.modules.theming.enable = mkEnableOption "theming";
|
||||
|
||||
options.theming = let colors = config.theming.schemeColors; in {
|
||||
@@ -162,6 +157,12 @@ in {
|
||||
description = "All available font modules.";
|
||||
};
|
||||
|
||||
installed = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = fontNameList;
|
||||
description = "List of installed fonts.";
|
||||
};
|
||||
|
||||
serif = mkOption {
|
||||
type = fontModule;
|
||||
description = "Default serif font";
|
||||
|
||||
@@ -6,5 +6,6 @@
|
||||
recommendedSize = 9;
|
||||
fallbackFonts = [
|
||||
"Cozette"
|
||||
"Symbols Nerd Font Mono"
|
||||
];
|
||||
}
|
||||
@@ -4,5 +4,7 @@
|
||||
name = "Fira Code";
|
||||
package = pkgs.fira-code;
|
||||
recommendedSize = 12;
|
||||
fallbackFonts = [];
|
||||
fallbackFonts = [
|
||||
"Symbols Nerd Font Mono"
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
name = "WenQuanYi Zen Hei";
|
||||
recommendedSize = 12;
|
||||
fallbackFonts = [];
|
||||
}
|
||||
@@ -11,6 +11,10 @@ in {
|
||||
type = types.anything;
|
||||
default = theme.fonts.pkgs."Fira Code";
|
||||
};
|
||||
fallbackFont = mkOption {
|
||||
type = types.anything;
|
||||
default = theme.fonts.pkgs."Symbols Nerd Font Mono";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
@@ -34,11 +38,12 @@ in {
|
||||
|
||||
userSettings = {
|
||||
# Font setup
|
||||
"editor.fontFamily" = mkForce cfg.codeFont.name;
|
||||
"editor.fontSize" = cfg.codeFont.recommendedSize;
|
||||
# TODO: Move the conversion factor to theme settings
|
||||
"editor.fontFamily" = mkForce "'${cfg.codeFont.name}', '${cfg.fallbackFont.name}'";
|
||||
"editor.fontSize" = mkForce (cfg.codeFont.recommendedSize); # Convert pt to px
|
||||
"editor.fontLigatures" = true;
|
||||
"terminal.integrated.fontFamily" = mkForce cfg.codeFont.name;
|
||||
"terminal.integrated.fontSize" = cfg.codeFont.recommendedSize;
|
||||
"terminal.integrated.fontFamily" = mkForce "'${cfg.codeFont.name}', '${cfg.fallbackFont.name}'";
|
||||
"terminal.integrated.fontSize" = mkForce (cfg.codeFont.recommendedSize); # Convert pt to px
|
||||
|
||||
# Autoformatting
|
||||
"editor.formatOnSave" = true;
|
||||
|
||||
Reference in new issue
Block a user