home: Add GTK theming, cursor fixes, etc

This commit is contained in:
NullBite 2024-05-15 23:48:42 -04:00
parent 20d248cb99
commit 2e2e16378a
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A
3 changed files with 59 additions and 14 deletions

View File

@ -2,22 +2,41 @@
let
cfg = config.nixfiles.theming;
mkCtpPackages = flavor: accent: let
toCaps = s: with lib.strings; with builtins;
(toUpper (substring 0 1 s)) + toLower (substring 1 ((stringLength s)-1) s);
inherit (lib.strings) toUpper toLower;
in with pkgs; {
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}";
cursorName = "Catppuccin-${toCaps flavor}-${toCaps accent}-Cursors";
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) ]; };
};
};
ctpPackages = with cfg.catppuccin; mkCtpPackages flavor 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;
@ -32,11 +51,34 @@ in {
};
config = lib.mkIf cfg.enable {
gtk.enable = true;
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 ctpPackages.cursors;
name = lib.mkDefault ctpPackages.cursorName;
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

@ -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";
};