Add theme font, icon options

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-07-03 20:20:16 +03:00
parent 4da4cee839
commit 4f3cedefa6
11 changed files with 156 additions and 20 deletions

View File

@@ -68,7 +68,11 @@
gestures.workspace_swipe_distance = 600;
};
programs.zsh.loginExtra = lib.mkBefore (builtins.readFile ./card.sh);
programs = {
zsh.loginExtra = lib.mkBefore (builtins.readFile ./card.sh);
# VSCode does not play well with fractional scaling
vscode.userSettings."window.zoomLevel" = (1.25 - 1) / 0.2;
};
theme = {
cursor.size = 24;

View File

@@ -236,6 +236,62 @@ in
};
font = {
sansSerif = {
names = mkOption {
type = listOf str;
default = [ "Roboto" ];
description = "The sans serif font families.";
};
packages = mkOption {
type = listOf package;
default = with pkgs; [ roboto ];
description = "The sans serif font packages.";
};
};
serif = {
names = mkOption {
type = listOf str;
default = [ "Roboto Serif" ];
description = "The serif font families.";
};
packages = mkOption {
type = listOf package;
default = with pkgs; [ roboto-serif ];
description = "The serif font packages.";
};
};
monospace = {
names = mkOption {
type = listOf str;
default = [ "JetBrainsMono Nerd Font" ];
description = "The monospace font families.";
};
packages = mkOption {
type = listOf package;
default = with pkgs; [ (nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) ];
description = "The monospace font packages.";
};
};
emoji = {
names = mkOption {
type = listOf str;
default = [ "Noto Emoji" "Font Awesome" ];
description = "The emoji font families.";
};
packages = mkOption {
type = listOf package;
default = with pkgs; [ noto-fonts-color-emoji font-awesome ];
description = "The emoji font packages.";
};
};
size = mkOption {
type = ints.positive;
default = 12;
@@ -243,17 +299,34 @@ in
};
};
cursor = {
package = mkOption {
type = package;
default = pkgs.gnome.adwaita-icon-theme;
description = "The package providing the cursor theme.";
icon = {
names = mkOption {
type = listOf str;
default = [ "Adwaita" ];
description = "The icon theme names.";
};
name = mkOption {
type = str;
default = "Adwaita";
description = "The cursor name within the package.";
packages = mkOption {
type = listOf package;
default = with pkgs; [
gnome.adwaita-icon-theme
nixos-icons
];
description = "The icon theme packages.";
};
};
cursor = {
names = mkOption {
type = listOf str;
default = [ "Adwaita" ];
description = "The cursor names.";
};
packages = mkOption {
type = listOf package;
default = with pkgs; [ gnome.adwaita-icon-theme ];
description = "The cursor theme packages.";
};
size = mkOption {
@@ -266,12 +339,29 @@ in
config = lib.mkIf cfg.enable {
home = {
packages = [ cfg.pkg ];
packages =
[ cfg.pkg ] ++
cfg.font.sansSerif.packages ++
cfg.font.serif.packages ++
cfg.font.monospace.packages ++
cfg.font.emoji.packages ++
cfg.icon.packages ++
cfg.cursor.packages;
pointerCursor = {
inherit (cfg.cursor) package name size;
gtk.enable = true;
x11.enable = true;
name = builtins.head cfg.cursor.names;
package = builtins.head cfg.cursor.packages;
inherit (cfg.cursor) size;
};
};
fonts.fontconfig = {
enable = true;
defaultFonts = {
sansSerif = cfg.font.sansSerif.names;
serif = cfg.font.serif.names;
monospace = cfg.font.monospace.names;
emoji = cfg.font.emoji.names;
};
};
};

View File

@@ -60,4 +60,6 @@
.label
color: {{colors.on_surface.default.hex}}
font-size: {{custom.font_size}}pt
font-family: {{custom.font_sans_serif_all}}
font-weight: 500
margin: 0 .5 * {{custom.padding}}pt

View File

@@ -13,12 +13,23 @@ in
name = "adw-gtk3-dark";
};
font = {
name = builtins.head hmConfig.theme.font.sansSerif.names;
package = builtins.head hmConfig.theme.font.sansSerif.packages;
inherit (hmConfig.theme.font) size;
};
iconTheme = {
name = builtins.head hmConfig.theme.icon.names;
package = builtins.head hmConfig.theme.icon.packages;
};
gtk2.configLocation = "${hmConfig.xdg.configHome}/gtk-2.0/gtkrc";
gtk3.extraCss = "@import './theme.css';";
gtk4.extraCss = "@import './theme.css';";
};
home.packages = with pkgs; [ nixos-icons ];
home.pointerCursor.gtk.enable = true;
programs.matugen.settings.templates = {
gtk3 = {

View File

@@ -17,4 +17,6 @@ decoration {
misc {
col.splash = rgb({{colors.on_surface.default.hex_stripped}})
background_color = rgb({{colors.surface.default.hex_stripped}})
font_family = {{custom.font_sans_serif}}
splash_font_family = {{custom.font_monospace}}
}

View File

@@ -8,6 +8,13 @@ in
programs = {
kitty = {
enable = true;
font = {
name = builtins.head hmConfig.theme.font.monospace.names;
package = builtins.head hmConfig.theme.font.monospace.packages;
inherit (hmConfig.theme.font) size;
};
extraConfig = ''
confirm_os_window_close 0
include theme.conf

View File

@@ -57,6 +57,14 @@ in
opacity_shadow = builtins.toString (hmConfig.theme.opacity * .75);
opacity_shadow_hex = builtins.toString (percentageToHex (hmConfig.theme.opacity * .75));
font_size = builtins.toString hmConfig.theme.font.size;
font_sans_serif = builtins.head hmConfig.theme.font.sansSerif.names;
font_sans_serif_all = builtins.concatStringsSep ", " hmConfig.theme.font.sansSerif.names;
font_serif = builtins.head hmConfig.theme.font.serif.names;
font_serif_all = builtins.concatStringsSep ", " hmConfig.theme.font.serif.names;
font_monospace = builtins.head hmConfig.theme.font.monospace.names;
font_monospace_all = builtins.concatStringsSep ", " hmConfig.theme.font.monospace.names;
font_emoji = builtins.head hmConfig.theme.font.emoji.names;
font_emoji_all = builtins.concatStringsSep ", " hmConfig.theme.font.emoji.names;
};
};

View File

@@ -5,11 +5,14 @@ let
in
{
home-manager.users.${user.name} = {
home = {
packages = with pkgs; [ rofi-wayland ];
persistence."/cache${user.home}".directories = [ "${hmConfig.xdg.relativeCacheHome}/rofi" ];
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland;
font = builtins.head hmConfig.theme.font.monospace.names;
};
home.persistence."/cache${user.home}".directories = [ "${hmConfig.xdg.relativeCacheHome}/rofi" ];
wayland.windowManager.hyprland.settings.bind = [
"$mod, r, exec, ${lib.meta.getExe pkgs.rofi-wayland} -cache-dir ${hmConfig.xdg.cacheHome}/rofi -show drun"
];

View File

@@ -1,5 +1,8 @@
{ user ? throw "user argument is required" }: { inputs, lib, pkgs, ... }:
{ user ? throw "user argument is required" }: { config, inputs, lib, pkgs, ... }:
let
hmConfig = config.home-manager.users.${user.name};
in
{
home-manager.users.${user.name} = {
programs.vscode = {
@@ -10,6 +13,9 @@
"editor.accessibilitySupport" = "off";
"editor.cursorBlinking" = "phase";
"editor.cursorSmoothCaretAnimation" = "on";
"editor.fontFamily" = builtins.concatStringsSep ", " hmConfig.theme.font.monospace.names;
"editor.fontLigatures" = true;
"editor.fontSize" = hmConfig.theme.font.size;
"editor.formatOnPaste" = true;
"editor.formatOnSave" = true;
"editor.formatOnType" = true;
@@ -50,6 +56,8 @@
"terminal.external.linuxExec" = "kitty";
"terminal.integrated.confirmOnExit" = "hasChildProcesses";
"terminal.integrated.copyOnSelection" = true;
"terminal.integrated.fontFamily" = builtins.concatStringsSep ", " hmConfig.theme.font.monospace.names;
"terminal.integrated.fontSize" = hmConfig.theme.font.size;
"window.autoDetectHighContrast" = false;
"window.menuBarVisibility" = "toggle";
"workbench.editor.historyBasedLanguageDetection" = true;

View File

@@ -5,6 +5,7 @@ let
in
{
home-manager.users.${user.name} = {
home.pointerCursor.x11.enable = true;
xresources.path = "${hmConfig.xdg.configHome}/X11/xresources";
};
}

View File

@@ -22,7 +22,7 @@ in
(import ../configs/swww { inherit user; })
(import ../configs/kitty { inherit user; })
(import ../configs/gtk { inherit user; })
(import ../configs/x { inherit user; })
(import ../configs/x11 { inherit user; })
(import ../configs/vscode { inherit user; })
(import ../configs/qalculate { inherit user; })
];