Add options to set font sizes (#60)

Fixes #35 and #59

Co-authored-by: Daniel Thwaites <danthwaites30@btinternet.com>
This commit is contained in:
Luc Chabassier 2023-03-19 19:39:32 +01:00 committed by GitHub
parent 9afac8a0a3
commit 50dcc46fe6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 71 additions and 20 deletions

View file

@ -23,6 +23,7 @@ in
family = monospace.name;
style = "Regular";
};
size = sizes.terminal;
};
import = [ themeFile ];
};

View file

@ -7,7 +7,7 @@ with config.stylix.fonts;
enable = config.lib.stylix.mkEnableTarget "bemenu" true;
fontSize = lib.mkOption {
type = with lib.types; nullOr int;
default = null;
default = sizes.popups;
}; # optional argument
alternate = lib.mkOption { type = lib.types.bool; default = false; };
};

View file

@ -11,7 +11,7 @@ with config.stylix.fonts;
services.dunst.settings = {
global = {
separator_color = base02;
font = sansSerif.name;
font = "${sansSerif.name} ${toString sizes.popups}";
};
urgency_low = {

View file

@ -19,7 +19,7 @@ let
)
# Convert to .pf2
${pkgs.grub2}/bin/grub-mkfont $font --output $out --size 17
${pkgs.grub2}/bin/grub-mkfont $font --output $out --size ${toString sizes.applications}
'';
in {

View file

@ -38,7 +38,10 @@ in {
# programs.dconf.enable = true; required in system config
gtk = {
enable = true;
font = config.stylix.fonts.sansSerif;
font = {
inherit (config.stylix.fonts.sansSerif) package name;
size = config.stylix.fonts.sizes.applications;
};
theme = {
package = pkgs.adw-gtk3;
name = "adw-gtk3";

View file

@ -8,8 +8,10 @@ let
focused = base0A;
unfocused = base03;
fonts = {
names = [ config.stylix.fonts.sansSerif.name ];
fonts = let
fonts = config.stylix.fonts;
in {
names = [ "${fonts.sansSerif.name} ${fonts.sizes.desktop}" ];
};
in {

View file

@ -19,7 +19,10 @@ in {
config = lib.mkIf cfg.enable {
programs.kitty = {
font = config.stylix.fonts.monospace;
font = {
inherit (config.stylix.fonts.monospace) package name;
size = config.stylix.fonts.sizes.terminal;
};
extraConfig = builtins.readFile theme;
};
};

View file

@ -13,7 +13,7 @@ with config.stylix.fonts;
borderColor = base0D;
textColor = base05;
progressColor = "over ${base02}";
font = sansSerif.name;
font = "${sansSerif.name} ${toString sizes.popups}";
# I wish the mako hm module was like the dunst one
extraConfig = ''
[urgency=low]

View file

@ -197,15 +197,17 @@ in {
};
};
fonts = {
default_family = sansSerif.name;
fonts = let
mkFont = name: "${name} ${toString sizes.applications}pt";
in {
default_family = mkFont sansSerif.name;
web.family = {
cursive = serif.name;
fantasy = serif.name;
fixed = monospace.name;
sans_serif = sansSerif.name;
serif = serif.name;
standard = sansSerif.name;
cursive = mkFont serif.name;
fantasy = mkFont serif.name;
fixed = mkFont monospace.name;
sans_serif = mkFont sansSerif.name;
serif = mkFont serif.name;
standard = mkFont sansSerif.name;
};
};
};

View file

@ -18,7 +18,7 @@ in
config = lib.mkIf config.stylix.targets.rofi.enable {
programs.rofi = {
font = monospace.name;
font = "${monospace.name} ${toString sizes.popups}";
theme = themeFile;
};
};

View file

@ -10,7 +10,7 @@ let
fonts = {
names = [ config.stylix.fonts.sansSerif.name ];
size = 8.0;
size = config.stylix.fonts.sizes.desktop + 0.0;
};
in {

View file

@ -24,13 +24,15 @@ let
'';
};
vimOptions = {
vimOptions = let
fonts = config.stylix.fonts;
in {
plugins = [ themePlugin ];
extraConfig = ''
set termguicolors
colorscheme base16-stylix
unlet g:colors_name
set guifont=${escape [" "] config.stylix.fonts.monospace.name}:h10
set guifont=${escape [" "] fonts.monospace.name}:h${toString fonts.sizes.terminal}
'';
};

View file

@ -20,6 +20,7 @@ in
xresources = {
properties = {
"*.faceName" = monospace.name;
"*.faceSize" = sizes.terminal;
"*.renderFont" = true;
};
extraConfig = builtins.readFile themeFile;

View file

@ -3,6 +3,7 @@
with lib;
let
cfg = config.stylix.fonts;
fromOs = import ./fromos.nix { inherit lib args; };
@ -57,5 +58,41 @@ in {
name = "Noto Color Emoji";
};
};
sizes = {
desktop = mkOption {
description = ''
The font size used in window titles/bars/widgets elements of
the desktop.
'';
type = types.ints.unsigned;
default = fromOs [ "fonts" "sizes" "desktop" ] 10;
};
applications = mkOption {
description = ''
The font size used by applications.
'';
type = types.ints.unsigned;
default = fromOs [ "fonts" "sizes" "applications" ] 12;
};
terminal = mkOption {
description = ''
The font size for terminals/text editors.
'';
type = types.ints.unsigned;
default = fromOs [ "fonts" "sizes" "terminal" ] cfg.sizes.applications;
};
popups = mkOption {
description = ''
The font size for notifications/popups and in general overlay
elements of the desktop.
'';
type = types.ints.unsigned;
default = fromOs [ "fonts" "sizes" "popups" ] cfg.sizes.desktop;
};
};
};
}