nixcfg/homeManagerModules/desktop/theme.nix

251 lines
7.5 KiB
Nix
Raw Normal View History

2024-04-07 22:16:33 -04:00
{
pkgs,
lib,
config,
...
}: {
options = {
2024-05-27 16:56:00 -04:00
alyraffauf.desktop.theme = {
enable =
lib.mkEnableOption "GTK and Qt themes.";
gtk = {
name = lib.mkOption {
description = "GTK theme name.";
default = "Catppuccin-Frappe-Compact-Mauve-Dark";
type = lib.types.str;
};
package = lib.mkOption {
description = "GTK theme package.";
default = pkgs.catppuccin-gtk.override {
accents = ["mauve"];
size = "compact";
variant = "frappe";
tweaks = ["normal"];
};
type = lib.types.package;
};
hideTitleBar = lib.mkOption {
description = "Whether to hide GTK3/4 titlebars (useful for some window managers).";
default = false;
type = lib.types.bool;
};
};
qt = {
name = lib.mkOption {
description = "Qt Kvantum theme name.";
default = "Catppuccin-Frappe-Mauve";
type = lib.types.str;
};
package = lib.mkOption {
description = "Qt Kvantum theme package.";
default = pkgs.catppuccin-kvantum.override {
accent = "Mauve";
variant = "Frappe";
};
type = lib.types.package;
};
};
2024-05-27 16:56:00 -04:00
iconTheme = {
name = lib.mkOption {
description = "Icon theme name.";
default = "Papirus-Dark";
type = lib.types.str;
};
package = lib.mkOption {
description = "Icon theme package.";
default = pkgs.catppuccin-papirus-folders.override {
flavor = "frappe";
accent = "mauve";
};
type = lib.types.package;
};
};
2024-05-27 16:56:00 -04:00
cursorTheme = {
name = lib.mkOption {
description = "Cursor theme name.";
default = "Catppuccin-Frappe-Dark-Cursors";
type = lib.types.str;
};
size = lib.mkOption {
description = "Cursor size.";
default = 24;
type = lib.types.int;
};
package = lib.mkOption {
description = "Cursor theme package.";
default = pkgs.catppuccin-cursors.frappeDark;
type = lib.types.package;
};
2024-05-04 20:51:15 -04:00
};
2024-05-27 16:56:00 -04:00
font = {
name = lib.mkOption {
description = "Font name.";
default = "NotoSans Nerd Font";
type = lib.types.str;
};
size = lib.mkOption {
description = "Font size.";
default = 11;
type = lib.types.int;
};
package = lib.mkOption {
description = "Font package.";
default = pkgs.nerdfonts.override {fonts = ["Noto"];};
type = lib.types.package;
};
};
2024-05-27 16:56:00 -04:00
terminalFont = {
name = lib.mkOption {
description = "Font name.";
default = "NotoSansM Nerd Font";
type = lib.types.str;
};
size = lib.mkOption {
description = "Font size.";
default = 11;
type = lib.types.int;
};
package = lib.mkOption {
description = "Font package.";
default = pkgs.nerdfonts.override {fonts = ["Noto"];};
type = lib.types.package;
};
};
2024-05-27 16:56:00 -04:00
colors = {
preferDark = lib.mkOption {
description = "Whether to prefer dark mode apps or not.";
default = config.alyraffauf.desktop.theme.enable;
type = lib.types.bool;
};
text = lib.mkOption {
description = "Text color.";
default = "#FAFAFA";
type = lib.types.str;
};
background = lib.mkOption {
description = "Background color.";
default = "#232634";
type = lib.types.str;
};
primary = lib.mkOption {
description = "Primary color.";
default = "#CA9EE6";
type = lib.types.str;
};
secondary = lib.mkOption {
description = "Secondary color.";
default = "#99D1DB";
type = lib.types.str;
};
inactive = lib.mkOption {
description = "Inactive color.";
default = "#626880";
type = lib.types.str;
};
shadow = lib.mkOption {
description = "Drop shadow color.";
default = "#1A1A1A";
type = lib.types.str;
};
};
2024-05-27 16:56:00 -04:00
wallpaper = lib.mkOption {
description = "Default wallpaper.";
default = "${config.xdg.dataHome}/backgrounds/jr-korpa-9XngoIpxcEo-unsplash.jpg";
type = lib.types.str;
};
};
};
config = lib.mkIf config.alyraffauf.desktop.theme.enable {
home.pointerCursor = {
gtk.enable = true;
x11.enable = true;
package = config.alyraffauf.desktop.theme.cursorTheme.package;
name = config.alyraffauf.desktop.theme.cursorTheme.name;
size = config.alyraffauf.desktop.theme.cursorTheme.size;
};
2024-05-28 18:53:52 -04:00
qt = {
enable = true;
platformTheme.name = "qtct";
style.name = "kvantum";
};
2024-05-29 21:02:20 -04:00
xdg.configFile = {
"Kvantum/${config.alyraffauf.desktop.theme.qt.name}".source = "${config.alyraffauf.desktop.theme.qt.package}/share/Kvantum/${config.alyraffauf.desktop.theme.qt.name}";
"Kvantum/kvantum.kvconfig".source = (pkgs.formats.ini {}).generate "kvantum.kvconfig" {
General.theme = config.alyraffauf.desktop.theme.qt.name;
};
};
2024-05-12 14:27:46 -04:00
fonts.fontconfig = {
enable = true;
defaultFonts = {
monospace = [config.alyraffauf.desktop.theme.terminalFont.name];
2024-05-12 21:32:57 -04:00
serif = ["NotoSerif Nerd Font"];
2024-05-12 14:27:46 -04:00
sansSerif = [config.alyraffauf.desktop.theme.font.name];
};
};
gtk = {
enable = true;
theme = {
package = config.alyraffauf.desktop.theme.gtk.package;
name = config.alyraffauf.desktop.theme.gtk.name;
};
iconTheme = {
package = config.alyraffauf.desktop.theme.iconTheme.package;
name = config.alyraffauf.desktop.theme.iconTheme.name;
};
font = {
2024-05-12 21:32:57 -04:00
name = "${config.alyraffauf.desktop.theme.font.name} Regular";
package = config.alyraffauf.desktop.theme.font.package;
size = config.alyraffauf.desktop.theme.font.size;
};
gtk3.extraConfig = lib.attrsets.optionalAttrs (config.alyraffauf.desktop.theme.colors.preferDark) {gtk-application-prefer-dark-theme = 1;};
gtk4.extraConfig = lib.attrsets.optionalAttrs (config.alyraffauf.desktop.theme.colors.preferDark) {gtk-application-prefer-dark-theme = 1;};
gtk3.extraCss =
if config.alyraffauf.desktop.theme.gtk.hideTitleBar
then ''
/* No (default) title bar on wayland */
headerbar.default-decoration {
/* You may need to tweak these values depending on your GTK theme */
margin-bottom: 50px;
margin-top: -100px;
background: transparent;
padding: 0;
border: 0;
min-height: 0;
font-size: 0;
box-shadow: none;
}
/* rm -rf window shadows */
window.csd, /* gtk4? */
window.csd decoration { /* gtk3 */
box-shadow: none;
}
''
else "/* */";
gtk4.extraCss = config.gtk.gtk3.extraCss;
};
dconf.settings = {
"org/gnome/desktop/interface" = {
gtk-theme = config.alyraffauf.desktop.theme.gtk.name;
color-scheme = "prefer-dark";
cursor-theme = config.alyraffauf.desktop.theme.cursorTheme.name;
cursor-size = config.alyraffauf.desktop.theme.cursorTheme.size;
};
};
};
}