Compare commits

...

2 Commits

6 changed files with 97 additions and 3 deletions

View File

@ -4,5 +4,6 @@
./wm
./nodm.nix
./nix.nix
./theme.nix
];
}

87
home/common/theme.nix Normal file
View File

@ -0,0 +1,87 @@
{ config, lib, pkgs, ... }:
let
cfg = config.nixfiles.theming;
toCaps = s: with lib.strings; with builtins;
(toUpper (substring 0 1 s)) + toLower (substring 1 ((stringLength s)-1) s);
inherit (lib.strings) toUpper toLower;
mkCtp = flavor: accent: with pkgs; {
names = {
cursors = "Catppuccin-${toCaps flavor}-${toCaps accent}-Cursors";
icons = "Papirus-Dark";
gtk = let
base = "Catppuccin-${toCaps flavor}-Standard-${toCaps accent}-Dark";
in {
normal = "${base}";
hdpi = "${base}-hdpi";
xhdpi = "${base}-xhdpi";
};
};
packages = {
cursors = catppuccin-cursors."${toLower flavor}${toCaps accent}";
kvantum = catppuccin-kvantum.override { variant = toCaps flavor; accent = toCaps accent; };
icons = catppuccin-papirus-folders.override { flavor = toLower flavor; accent = toLower accent; };
gtk = catppuccin-gtk.override { variant = toLower flavor; accents = [ (toLower accent) ]; };
};
};
ctp = with cfg.catppuccin; mkCtp flavor accent;
in {
options.nixfiles.theming = {
enable = lib.mkEnableOption "nixfiles theming options";
catppuccin = {
themeDPI = lib.mkOption {
description = "Catppuccin theme DPI preset";
type = with lib.types; oneOf (mapAttrsToList (k: v: k) ctp.names.gtk);
default = "normal";
};
flavor = lib.mkOption {
description = "Catppuccin flavor";
type = lib.types.str;
default = "mocha";
};
accent = lib.mkOption {
description = "Catppuccin accent";
type = lib.types.str;
default = "mauve";
};
};
};
config = lib.mkIf cfg.enable {
fonts.fontconfig.enable = lib.mkDefault true;
home.packages = with pkgs; [
ubuntu_font_family
] ++ lib.mapAttrsToList (k: v: v) ctp.packages;
gtk = {
enable = true;
font = lib.mkDefault {
name = "Ubuntu";
package = pkgs.ubuntu_font_family;
size = 12;
};
theme = lib.mkDefault {
package = ctp.packages.gtk;
name = ctp.names.gtk.normal;
};
iconTheme = lib.mkDefault {
name = ctp.names.icons;
package = ctp.packages.icons;
};
};
home.pointerCursor = {
package = lib.mkDefault ctp.packages.cursors;
name = lib.mkDefault ctp.names.cursors;
size = lib.mkDefault 24;
x11.enable = lib.mkDefault true;
gtk.enable = lib.mkDefault true;
};
};
}

View File

@ -22,6 +22,8 @@ in
# Common options for standalone window managers; many of these (or
# alternatives thereof) are pulled in by desktop environments.
nixfiles.theming.enable = lib.mkDefault true;
qt.enable = true;
qt.platformTheme.name = "qtct";
qt.style.name = "kvantum";

View File

@ -84,8 +84,9 @@ in
};
# this fixes a lot of theme weirdness
home.file.".icons".source = config.lib.file.mkOutOfStoreSymlink "${config.xdg.dataHome}/icons";
home.file.".themes".source = config.lib.file.mkOutOfStoreSymlink "${config.xdg.dataHome}/themes";
# this actually breaks home-manager's icon/theme management
# home.file.".icons".source = config.lib.file.mkOutOfStoreSymlink "${config.xdg.dataHome}/icons";
# home.file.".themes".source = config.lib.file.mkOutOfStoreSymlink "${config.xdg.dataHome}/themes";
# some packages defined here may be redundant with packages on a non-NixOS
# home-manager setup, but it's better to have a consistent environment at

View File

@ -150,7 +150,7 @@ in
# source = ~/.config/hypr/myColors.conf
# Some default env vars.
env = mkd "XCURSOR_SIZE,24";
# env = mkd "XCURSOR_SIZE,24";
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/

View File

@ -16,6 +16,9 @@
};
home.stateVersion = "23.11";
home.pointerCursor = lib.mkIf config.nixfiles.theming.enable { size = 32; };
nixfiles.theming.catppuccin.themeDPI = "hdpi";
wayland.windowManager.hyprland.settings = {
monitor = ",preferred,auto,1.25";
};