theme: add font options (#76)
Some checks are pending
git-mirror / gitlab-sync (push) Waiting to run
nix-build / default-build (push) Waiting to run
nix-build / fallarbor-build (push) Waiting to run
nix-build / lavaridge-build (push) Waiting to run
nix-build / mauville-build (push) Waiting to run
nix-build / petalburg-build (push) Waiting to run
nix-build / rustboro-build (push) Waiting to run
nix-check / fmt-check (push) Waiting to run
nix-check / eval-check (push) Waiting to run

* swaylock: update to standard font name

* theme: setup font options and mgirate theme.nix

* zed: migrate to font modules

* swaylock: migrate to font modules

* kitty: migrate to font modules

* fuzzel: migrate to font modules

* vsCodium: migrate to font modules

* rofi: migrate to font modules

* rofi: migrate to font modules

* waybar: migrate to font modules

* alacritty: migrate to font modules

* alacritty: pull font size from theme module

* nixfmt

* rustboro: migrate font overrides

* waybar: calculate font size from theme font settings

* vsCodium: set font size from module

* zed: set font size from module

* sway: migrate to font modules

* wlogout: migrate to font modules

* mako: migrate to font modules

* sway: fix improper option reference
This commit is contained in:
Aly Raffauf 2024-08-07 23:09:31 -04:00 committed by GitHub
parent 6fcbab02f3
commit 23c783cfc5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 138 additions and 109 deletions

View file

@ -2,8 +2,10 @@
config, config,
lib, lib,
... ...
}: { }: let
config = lib.mkIf config.ar.home.apps.alacritty.enable { cfg = config.ar.home;
in {
config = lib.mkIf cfg.apps.alacritty.enable {
programs.alacritty = { programs.alacritty = {
enable = true; enable = true;
settings = { settings = {
@ -11,8 +13,8 @@
draw_bold_text_with_bright_colors = true; draw_bold_text_with_bright_colors = true;
primary = { primary = {
background = "${config.ar.home.theme.colors.background}"; background = "${cfg.theme.colors.background}";
foreground = "${config.ar.home.theme.colors.text}"; foreground = "${cfg.theme.colors.text}";
}; };
transparent_background_colors = true; transparent_background_colors = true;
@ -20,11 +22,11 @@
font = { font = {
normal = { normal = {
family = "UbuntuSans Nerd Font"; family = cfg.theme.font.monospaceFont.name;
style = "Regular"; style = "Regular";
}; };
size = config.gtk.font.size + 1; size = cfg.theme.font.monospaceFont.size + 1;
}; };
selection.save_to_clipboard = true; selection.save_to_clipboard = true;

View file

@ -2,8 +2,10 @@
config, config,
lib, lib,
... ...
}: { }: let
config = lib.mkIf config.ar.home.apps.fuzzel.enable { cfg = config.ar.home;
in {
config = lib.mkIf cfg.apps.fuzzel.enable {
programs.fuzzel = { programs.fuzzel = {
enable = true; enable = true;
settings = { settings = {
@ -13,21 +15,21 @@
}; };
main = { main = {
font = "UbuntuSansMono Nerd Font:size=${toString config.gtk.font.size}"; font = "${cfg.theme.monospaceFont.name}:size=${toString cfg.theme.monospaceFont.size}";
icon-theme = "${config.gtk.iconTheme.name}"; icon-theme = "${config.gtk.iconTheme.name}";
layer = "overlay"; layer = "overlay";
lines = 3; lines = 3;
terminal = lib.getExe config.ar.home.defaultApps.terminal; terminal = lib.getExe cfg.defaultApps.terminal;
width = 36; width = 36;
}; };
colors = { colors = {
background = "${config.ar.home.theme.colors.background}CC"; background = "${cfg.theme.colors.background}CC";
border = "${config.ar.home.theme.colors.primary}EE"; border = "${cfg.theme.colors.primary}EE";
selection = "${config.ar.home.theme.colors.background}FF"; selection = "${cfg.theme.colors.background}FF";
selection-match = "${config.ar.home.theme.colors.primary}FF"; selection-match = "${cfg.theme.colors.primary}FF";
selection-text = "${config.ar.home.theme.colors.secondary}FF"; selection-text = "${cfg.theme.colors.secondary}FF";
text = "${config.ar.home.theme.colors.text}FF"; text = "${cfg.theme.colors.text}FF";
}; };
}; };
}; };

View file

@ -3,14 +3,16 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }: let
config = lib.mkIf config.ar.home.apps.kitty.enable { cfg = config.ar.home;
in {
config = lib.mkIf cfg.apps.kitty.enable {
programs.kitty = { programs.kitty = {
enable = true; enable = true;
font = { font = {
name = "UbuntuSansMono Nerd Font"; name = cfg.theme.monospaceFont.name;
size = config.gtk.font.size + 1; size = cfg.theme.monospaceFont.size + 1;
}; };
settings = { settings = {

View file

@ -15,7 +15,7 @@ in {
programs.rofi = { programs.rofi = {
enable = true; enable = true;
font = "UbuntuSansMono Nerd Font ${toString config.gtk.font.size}"; font = "${cfg.theme.monospaceFont.name} ${toString cfg.theme.monospaceFont.size}";
location = "center"; location = "center";
package = pkgs.rofi-wayland; package = pkgs.rofi-wayland;

View file

@ -3,8 +3,10 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }: let
config = lib.mkIf config.ar.home.apps.swaylock.enable { cfg = config.ar.home;
in {
config = lib.mkIf cfg.apps.swaylock.enable {
home.packages = with pkgs; [swaylock]; home.packages = with pkgs; [swaylock];
programs.swaylock.enable = true; programs.swaylock.enable = true;
@ -15,8 +17,8 @@
caps-lock-key-hl-color=e78284 caps-lock-key-hl-color=e78284
color=303446 color=303446
daemonize daemonize
font="UbuntuSansMonoNerdFont-Regular" font="${cfg.theme.monospaceFont.name}"
image=${config.ar.home.theme.wallpaper} image=${cfg.theme.wallpaper}
indicator-caps-lock indicator-caps-lock
indicator-idle-visible indicator-idle-visible
indicator-radius=120 indicator-radius=120
@ -27,18 +29,18 @@
inside-ver-color=303446cc inside-ver-color=303446cc
inside-wrong-color=303446cc inside-wrong-color=303446cc
key-hl-color=a6d189 key-hl-color=a6d189
line-caps-lock-color=${config.ar.home.theme.colors.background}CC line-caps-lock-color=${cfg.theme.colors.background}CC
line-clear-color=${config.ar.home.theme.colors.background}CC line-clear-color=${cfg.theme.colors.background}CC
line-color=${config.ar.home.theme.colors.background}CC line-color=${cfg.theme.colors.background}CC
line-ver-color=${config.ar.home.theme.colors.background}CC line-ver-color=${cfg.theme.colors.background}CC
line-wrong-color=${config.ar.home.theme.colors.background}CC line-wrong-color=${cfg.theme.colors.background}CC
ring-caps-lock-color=e78284cc ring-caps-lock-color=e78284cc
ring-clear-color=85c1dccc ring-clear-color=85c1dccc
ring-color=${config.ar.home.theme.colors.primary}CC ring-color=${cfg.theme.colors.primary}CC
ring-ver-color=a6d189cc ring-ver-color=a6d189cc
ring-wrong-color=e78284cc ring-wrong-color=e78284cc
scaling=fill scaling=fill
separator-color=${config.ar.home.theme.colors.background}CC separator-color=${cfg.theme.colors.background}CC
text-caps-lock-color=c6d0f5 text-caps-lock-color=c6d0f5
text-clear-color=c6d0f5 text-clear-color=c6d0f5
text-ver-color=c6d0f5 text-ver-color=c6d0f5

View file

@ -3,8 +3,10 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }: let
config = lib.mkIf config.ar.home.apps.vsCodium.enable { cfg = config.ar.home;
in {
config = lib.mkIf cfg.apps.vsCodium.enable {
programs.vscode = { programs.vscode = {
enable = true; enable = true;
package = pkgs.vscodium; package = pkgs.vscodium;
@ -32,8 +34,8 @@
userSettings = { userSettings = {
"diffEditor.ignoreTrimWhitespace" = false; "diffEditor.ignoreTrimWhitespace" = false;
"editor.fontFamily" = "'UbuntuSansMono Nerd Font', 'monospace', monospace"; "editor.fontFamily" = "'${cfg.theme.monospaceFont.name} ${toString cfg.theme.monospaceFont.size}', 'monospace', monospace";
"editor.fontSize" = lib.mkDefault 14; "editor.fontSize" = cfg.theme.monospaceFont.size + 3;
"editor.formatOnPaste" = true; "editor.formatOnPaste" = true;
"editor.formatOnSave" = true; "editor.formatOnSave" = true;
"editor.formatOnType" = true; "editor.formatOnType" = true;
@ -75,14 +77,14 @@
"shellformat.flag" = "-i 4"; "shellformat.flag" = "-i 4";
"terminal.external.linuxExec" = lib.getExe config.ar.home.defaultApps.terminal; "terminal.external.linuxExec" = lib.getExe cfg.defaultApps.terminal;
"terminal.integrated.fontSize" = lib.mkDefault 14; "terminal.integrated.fontSize" = cfg.theme.monospaceFont.size + 3;
"update.mode" = "none"; "update.mode" = "none";
"window.menuBarVisibility" = "hidden"; "window.menuBarVisibility" = "hidden";
"window.titleBarStyle" = lib.mkDefault "native"; "window.titleBarStyle" = lib.mkDefault "native";
"window.zoomPerWindow" = false; "window.zoomPerWindow" = false;
"workbench.colorTheme" = "workbench.colorTheme" =
if config.ar.home.theme.darkMode if cfg.theme.darkMode
then "Adwaita Dark" then "Adwaita Dark"
else "Adwaita Light"; else "Adwaita Light";
"workbench.iconTheme" = "vs-seti"; "workbench.iconTheme" = "vs-seti";

View file

@ -3,8 +3,10 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }: let
config = lib.mkIf config.ar.home.apps.wlogout.enable { cfg = config.ar.home;
in {
config = lib.mkIf cfg.apps.wlogout.enable {
programs.wlogout = { programs.wlogout = {
enable = true; enable = true;
@ -33,7 +35,7 @@
* { * {
background-image: none; background-image: none;
box-shadow: none; box-shadow: none;
font-family: "${config.gtk.font.name}", sans-serif; font-family: "${cfg.theme.sansFont.name}", sans-serif;
transition: 20ms; transition: 20ms;
} }
@ -42,21 +44,21 @@
} }
button { button {
background-color: ${config.ar.home.theme.colors.background}; background-color: ${cfg.theme.colors.background};
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 25%; background-size: 25%;
border-color: ${config.ar.home.theme.colors.primary}; border-color: ${cfg.theme.colors.primary};
border-radius: 10; border-radius: 10;
border-style: solid; border-style: solid;
border-width: 2; border-width: 2;
color: ${config.ar.home.theme.colors.text}; color: ${cfg.theme.colors.text};
margin: 5px; margin: 5px;
text-decoration-color: ${config.ar.home.theme.colors.text}; text-decoration-color: ${cfg.theme.colors.text};
} }
button:active, button:hover { button:active, button:hover {
background-color: ${config.ar.home.theme.colors.primary}; background-color: ${cfg.theme.colors.primary};
outline-style: none; outline-style: none;
} }

View file

@ -3,10 +3,12 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }: let
config = lib.mkIf config.ar.home.apps.zed.enable { cfg = config.ar.home;
in {
config = lib.mkIf cfg.apps.zed.enable {
home.packages = [ home.packages = [
config.ar.home.apps.zed.package cfg.apps.zed.package
pkgs.nixd pkgs.nixd
]; ];
@ -22,7 +24,7 @@
}; };
} }
]; ];
keymaps = defaults ++ config.ar.home.apps.zed.keymaps; keymaps = defaults ++ cfg.apps.zed.keymaps;
in in
lib.generators.toJSON {} keymaps; lib.generators.toJSON {} keymaps;
@ -46,8 +48,8 @@
auto_update = false; auto_update = false;
autosave.after_delay.milliseconds = 1000; autosave.after_delay.milliseconds = 1000;
buffer_font_family = "UbuntuSansMono Nerd Font"; buffer_font_family = cfg.theme.monospaceFont.name;
buffer_font_size = 14; buffer_font_size = cfg.theme.monospaceFont.size + 3;
current_line_highlight = "line"; current_line_highlight = "line";
indent_guides = { indent_guides = {
@ -87,7 +89,7 @@
metrics = false; metrics = false;
}; };
terminal.font_size = 14; terminal.font_size = cfg.theme.monospaceFont.size + 3;
theme = { theme = {
dark = "Adwaita Pastel Dark"; dark = "Adwaita Pastel Dark";
@ -95,13 +97,13 @@
mode = "system"; mode = "system";
}; };
ui_font_family = "UbuntuSans Nerd Font"; ui_font_family = cfg.theme.sansFont.name;
ui_font_size = 16; ui_font_size = cfg.theme.sansFont.size + 5;
use_autoclose = false; use_autoclose = false;
vim_mode = false; vim_mode = false;
}; };
settings = defaults // config.ar.home.apps.zed.settings; settings = defaults // cfg.apps.zed.settings;
in in
lib.generators.toJSON {} settings; lib.generators.toJSON {} settings;
}; };

View file

@ -58,9 +58,9 @@ in {
}; };
fonts = { fonts = {
names = ["${config.gtk.font.name}"]; names = [cfg.theme.sansFont.name];
style = "Bold"; style = "Bold";
size = config.gtk.font.size + 0.0; size = cfg.theme.sansFont.size + 0.0;
}; };
gaps = { gaps = {

View file

@ -197,7 +197,27 @@ in {
waybar.enable = lib.mkEnableOption "Waybar wayland panel."; waybar.enable = lib.mkEnableOption "Waybar wayland panel.";
}; };
theme = { theme = let
mkFontOption = typ: nam: pkg: siz: {
name = lib.mkOption {
description = "Default ${typ} font name.";
default = nam;
type = lib.types.str;
};
package = lib.mkOption {
description = "Default ${typ} font package.";
default = pkg;
type = lib.types.package;
};
size = lib.mkOption {
description = "Default ${typ} font size.";
default = siz;
type = lib.types.int;
};
};
in {
enable = lib.mkEnableOption "Gtk, Qt, and application colors."; enable = lib.mkEnableOption "Gtk, Qt, and application colors.";
darkMode = lib.mkOption { darkMode = lib.mkOption {
@ -244,6 +264,10 @@ in {
}; };
}; };
sansFont = mkFontOption "sans serif" "UbuntuSans Nerd Font" (pkgs.nerdfonts.override {fonts = ["UbuntuSans"];}) 11;
serifFont = mkFontOption "serif" "Vegur" pkgs.vegur 11;
monospaceFont = mkFontOption "monospace" "UbuntuSansMono Nerd Font" (pkgs.nerdfonts.override {fonts = ["UbuntuSans"];}) 11;
gtk.hideTitleBar = lib.mkOption { gtk.hideTitleBar = lib.mkOption {
description = "Whether to hide GTK3/4 titlebars (useful for some window managers)."; description = "Whether to hide GTK3/4 titlebars (useful for some window managers).";
default = false; default = false;

View file

@ -3,25 +3,27 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }: let
config = lib.mkIf config.ar.home.services.mako.enable { cfg = config.ar.home;
in {
config = lib.mkIf cfg.services.mako.enable {
services.mako = { services.mako = {
actions = true; actions = true;
anchor = "top-center"; anchor = "top-center";
backgroundColor = "${config.ar.home.theme.colors.background}CC"; backgroundColor = "${cfg.theme.colors.background}CC";
borderColor = "${config.ar.home.theme.colors.primary}EE"; borderColor = "${cfg.theme.colors.primary}EE";
borderRadius = 10; borderRadius = 10;
borderSize = 2; borderSize = 2;
defaultTimeout = 10000; defaultTimeout = 10000;
enable = true; enable = true;
font = "${config.gtk.font.name} Regular ${toString config.gtk.font.size}"; font = "${cfg.theme.sansFont.name} Regular ${toString cfg.theme.sansFont.size}";
height = 300; height = 300;
iconPath = "${pkgs.papirus-icon-theme}/share/icons/Papirus/"; iconPath = "${pkgs.papirus-icon-theme}/share/icons/Papirus/";
icons = true; icons = true;
layer = "top"; layer = "top";
margin = "20,0"; margin = "20,0";
padding = "15"; padding = "15";
textColor = "${config.ar.home.theme.colors.text}"; textColor = "${cfg.theme.colors.text}";
width = 400; width = 400;
extraConfig = '' extraConfig = ''

View file

@ -3,8 +3,10 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }: let
config = lib.mkIf config.ar.home.services.waybar.enable { cfg = config.ar.home;
in {
config = lib.mkIf cfg.services.waybar.enable {
programs.waybar = { programs.waybar = {
enable = true; enable = true;
@ -15,11 +17,11 @@
output = ["*"]; output = ["*"];
position = "top"; position = "top";
modules-left = modules-left =
lib.optionals (config.ar.home.desktop.hyprland.enable) lib.optionals (cfg.desktop.hyprland.enable)
["hyprland/workspaces" "hyprland/submap"] ["hyprland/workspaces" "hyprland/submap"]
++ lib.optionals (config.ar.home.desktop.sway.enable) ++ lib.optionals (cfg.desktop.sway.enable)
["sway/workspaces" "sway/scratchpad" "sway/mode"] ["sway/workspaces" "sway/scratchpad" "sway/mode"]
++ lib.optionals (config.ar.home.desktop.hyprland.tabletMode.enable) ++ lib.optionals (cfg.desktop.hyprland.tabletMode.enable)
["custom/menu" "custom/hyprland-close"]; ["custom/menu" "custom/hyprland-close"];
modules-center = ["clock"]; modules-center = ["clock"];
@ -256,25 +258,25 @@
* { * {
border: none; border: none;
border-radius: 0px; border-radius: 0px;
font-family: "UbuntuSansMono Nerd Font"; font-family: "${cfg.theme.monospaceFont.name}";
font-size: 14px; font-size: ${toString (cfg.theme.monospaceFont.size + 3)}px;
font-weight: 600; font-weight: 600;
} }
window#waybar { window#waybar {
background: rgba (35, 38, 52, 0.0); background: rgba (35, 38, 52, 0.0);
color: ${config.ar.home.theme.colors.text}; color: ${cfg.theme.colors.text};
} }
#workspaces button { #workspaces button {
padding: 0px 5px; padding: 0px 5px;
margin: 0px 0px; margin: 0px 0px;
color: ${config.ar.home.theme.colors.text}; color: ${cfg.theme.colors.text};
} }
#workspaces button.active, #workspaces button.active,
#workspaces button.focused { #workspaces button.focused {
color: ${config.ar.home.theme.colors.primary}; color: ${cfg.theme.colors.primary};
} }
#clock, #clock,
@ -294,11 +296,11 @@
} }
#battery { #battery {
color: ${config.ar.home.theme.colors.text}; color: ${cfg.theme.colors.text};
} }
#battery.charging { #battery.charging {
color: ${config.ar.home.theme.colors.primary}; color: ${cfg.theme.colors.primary};
} }
#battery.critical:not(.charging), #battery.critical:not(.charging),
@ -328,7 +330,7 @@
#submap, #submap,
#mode { #mode {
color: ${config.ar.home.theme.colors.text}; color: ${cfg.theme.colors.text};
background: rgba(255, 123, 99, 0.8); background: rgba(255, 123, 99, 0.8);
} }
''; '';

View file

@ -40,33 +40,16 @@
} }
''; '';
}; };
font = {
name = "UbuntuSans Nerd Font";
package = pkgs.nerdfonts.override {fonts = ["UbuntuSans"];};
size = 11;
};
monospaceFont = {
inherit (font) package size;
name = "UbuntuSansMono Nerd Font";
};
serifFont = {
inherit (font) size;
name = "Vegur";
package = pkgs.vegur;
};
in { in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home = { home = {
packages = [ packages = [
font.package cfg.monospaceFont.package
monospaceFont.package cfg.sansFont.package
cfg.serifFont.package
pkgs.adwaita-qt pkgs.adwaita-qt
pkgs.gnome.adwaita-icon-theme pkgs.gnome.adwaita-icon-theme
pkgs.liberation_ttf pkgs.liberation_ttf
serifFont.package
]; ];
pointerCursor = { pointerCursor = {
@ -86,9 +69,9 @@ in {
enable = true; enable = true;
defaultFonts = { defaultFonts = {
monospace = [monospaceFont.name]; monospace = [cfg.monospaceFont.name];
sansSerif = [font.name]; sansSerif = [cfg.sansFont.name];
serif = [serifFont.name]; serif = [cfg.serifFont.name];
}; };
}; };
@ -104,7 +87,7 @@ in {
package = pkgs.adw-gtk3; package = pkgs.adw-gtk3;
}; };
font = {inherit (font) name package size;}; font = {inherit (cfg.sansFont) name package size;};
iconTheme = { iconTheme = {
name = name =
@ -145,11 +128,11 @@ in {
then "prefer-dark" then "prefer-dark"
else "prefer-light"; else "prefer-light";
document-font-name = "${serifFont.name} ${toString serifFont.size}"; document-font-name = "${cfg.serifFont.name} ${toString cfg.serifFont.size}";
monospace-font-name = "${monospaceFont.name} ${toString monospaceFont.size}"; monospace-font-name = "${cfg.monospaceFont.name} ${toString cfg.monospaceFont.size}";
}; };
"org/gnome/desktop/wm/preferences".titlebar-font = "${font.name} ${toString font.size}"; "org/gnome/desktop/wm/preferences".titlebar-font = "${cfg.sansFont.name} ${toString cfg.sansFont.size}";
}; };
}; };
} }

View file

@ -1,8 +1,6 @@
{lib, ...}: { {
home-manager.sharedModules = [ home-manager.sharedModules = [
{ {
gtk.font.size = lib.mkForce 14;
home.pointerCursor.size = lib.mkForce 24;
wayland.windowManager.sway.config.output = {"LG Display 0x0569 Unknown".scale = "1.0";}; wayland.windowManager.sway.config.output = {"LG Display 0x0569 Unknown".scale = "1.0";};
ar.home = { ar.home = {
@ -12,6 +10,12 @@
enable = true; enable = true;
preset = "LoudnessEqualizer"; preset = "LoudnessEqualizer";
}; };
theme = {
monospaceFont.size = 14;
sansFont.size = 14;
serifFont.size = 14;
};
}; };
} }
]; ];