home: add basic theming (cursor only for now)

This commit is contained in:
NullBite 2024-05-15 22:43:43 -04:00
parent 65ef3a1217
commit 20d248cb99
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A
4 changed files with 51 additions and 2 deletions

View File

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

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

@ -0,0 +1,45 @@
{ config, lib, pkgs, ... }:
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; {
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; };
};
ctpPackages = with cfg.catppuccin; mkCtpPackages flavor accent;
in {
options.nixfiles.theming = {
enable = lib.mkEnableOption "nixfiles theming options";
catppuccin = {
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 {
gtk.enable = true;
home.pointerCursor = {
package = lib.mkDefault ctpPackages.cursors;
name = lib.mkDefault ctpPackages.cursorName;
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