refactor: major theme refactor

new profile catagory: theme. refactor modules for wallpaper, fonts, gtk,
and qt. adjusted modules that depend on old theming modules
This commit is contained in:
ooks-io 2024-04-06 22:38:54 +13:00
parent 7d910ba77c
commit f5e87f2a79
34 changed files with 217 additions and 118 deletions

View file

@ -2,19 +2,15 @@
{ {
imports = [ imports = [
./fonts
./monitors ./monitors
./wallpaper
./nix ./nix
./userDirs ./userDirs
./home ./home
./nixColors
./mimeApps ./mimeApps
]; ];
options.homeModules.config = { options.homeModules.config = {
nix.enable = lib.mkEnableOption "enable nix configuration module"; nix.enable = lib.mkEnableOption "enable nix configuration module";
nixColors.enable = lib.mkEnableOption "enable nixColors configuration module";
home.enable = lib.mkEnableOption "enable home configuration module"; home.enable = lib.mkEnableOption "enable home configuration module";
userDirs.enable = lib.mkEnableOption "enable userDirs configuration module"; userDirs.enable = lib.mkEnableOption "enable userDirs configuration module";
mimeApps.enable = lib.mkEnableOption "enable mimeApps configuration module"; mimeApps.enable = lib.mkEnableOption "enable mimeApps configuration module";

View file

@ -1,12 +0,0 @@
{ lib, ... }:
let inherit (lib) types mkOption;
in
{
options.wallpaper = mkOption {
type = types.path;
default = "";
description = ''
Wallpaper path
'';
};
}

View file

@ -3,5 +3,6 @@
./desktop ./desktop
./console ./console
./config ./config
./theme
]; ];
} }

View file

@ -2,6 +2,7 @@
let let
cfg = config.homeModules.desktop.browser.schizofox; cfg = config.homeModules.desktop.browser.schizofox;
fonts = config.homeModules.theme.fonts;
inherit (config.colorscheme) colors; inherit (config.colorscheme) colors;
in in
@ -13,7 +14,7 @@ in
programs.schizofox = { programs.schizofox = {
enable = true; enable = true;
theme = { theme = {
font = "${config.fontProfiles.regular.family}"; font = "${fonts.regular.family}";
colors = { colors = {
background-darker = "${colors.base00}"; background-darker = "${colors.base00}";
background = "${colors.base01}"; background = "${colors.base01}";

View file

@ -2,6 +2,7 @@
let let
cfg = config.homeModules.desktop.communication.discord; cfg = config.homeModules.desktop.communication.discord;
fonts = config.homeModules.theme.fonts;
inherit (config.colorscheme) colors; inherit (config.colorscheme) colors;
in in
@ -29,8 +30,8 @@ in
--nix-accent: #${colors.base08}; --nix-accent: #${colors.base08};
--nix-hi: #${colors.base0B}; --nix-hi: #${colors.base0B};
--font-mono: ${config.fontProfiles.monospace.family}, monospace; --font-mono: ${fonts.monospace.family}, monospace;
--font-regular: ${config.fontProfiles.regular.family}, sans serif; --font-regular: ${fonts.regular.family}, sans serif;
/* server collapse */ /* server collapse */
--sb-collapsed-width: 12px; --sb-collapsed-width: 12px;

View file

@ -1,6 +1,6 @@
{ {
imports = [ imports = [
./themeSettings # done # ./themeSettings # done
./browser # done -- firefox still need: chrome, brave ./browser # done -- firefox still need: chrome, brave
#./creative -- still needs to be implemented #./creative -- still needs to be implemented
./communication # only discord implemented ./communication # only discord implemented

View file

@ -3,6 +3,7 @@
let let
cfg = config.homeModules.desktop.productivity.zathura; cfg = config.homeModules.desktop.productivity.zathura;
inherit (config.colorscheme) colors; inherit (config.colorscheme) colors;
fonts = config.homeModules.theme.fonts;
in in
{ {
@ -10,7 +11,7 @@ in
programs.zathura = { programs.zathura = {
enable = true; enable = true;
options = { options = {
font = "${config.fontProfiles.regular.family} 14"; font = "${fonts.regular.family} 14";
recolor = true; recolor = true;
selection-clipboard = "clipboard"; selection-clipboard = "clipboard";
default-bg = "#${colors.base00}"; default-bg = "#${colors.base00}";

View file

@ -2,6 +2,7 @@
let let
inherit (config.colorscheme) colors; inherit (config.colorscheme) colors;
fonts = config.homeModules.theme.fonts;
cfg = config.homeModules.desktop.terminal.foot; cfg = config.homeModules.desktop.terminal.foot;
in in
@ -16,10 +17,10 @@ in
server.enable = true; server.enable = true;
settings = { settings = {
main = { main = {
font = "${config.fontProfiles.monospace.family}:pixelsize=18:antialias=true"; font = "${fonts.monospace.family}:pixelsize=18:antialias=true";
font-bold = "${config.fontProfiles.monospace.family}:style=Bold:pixelsize=18:antialias=true"; font-bold = "${fonts.monospace.family}:style=Bold:pixelsize=18:antialias=true";
font-italic = "${config.fontProfiles.monospace.family}:style=Italic:pixelsize=18:antialias=true"; font-italic = "${fonts.monospace.family}:style=Italic:pixelsize=18:antialias=true";
font-bold-italic = "${config.fontProfiles.monospace.family}:style=Bold Italic:pixelsize=18:antialias=true"; font-bold-italic = "${fonts.monospace.family}:style=Bold Italic:pixelsize=18:antialias=true";
dpi-aware = "yes"; dpi-aware = "yes";
letter-spacing = "-1px"; letter-spacing = "-1px";
bold-text-in-bright = "palette-based"; bold-text-in-bright = "palette-based";

View file

@ -2,7 +2,9 @@
let let
inherit (config.colorscheme) colors; inherit (config.colorscheme) colors;
fonts = config.homeModules.theme.font;
cfg = config.homeModules.desktop.terminal.kitty; cfg = config.homeModules.desktop.terminal.kitty;
fish = config.homeModules.console.shell.fish;
in in
{ {
@ -14,10 +16,10 @@ in
programs.kitty = { programs.kitty = {
enable = true; enable = true;
font = { font = {
name = config.fontProfiles.monospace.family; name = fonts.monospace.family;
size = 12; size = 12;
}; };
shellIntegration.enableFishIntegration = true; shellIntegration.enableFishIntegration = lib.mkif fish.enable true;
settings = { settings = {
scrollback_lines = 4000; scrollback_lines = 4000;
scrollback_pager_history_size = 2048; scrollback_pager_history_size = 2048;

View file

@ -1,16 +0,0 @@
{ pkgs, lib, config, ... }:
let
cfg = config.homeModules.desktop.themeSettings;
in
{
config = lib.mkIf cfg.enable {
home.pointerCursor = {
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Ice";
size = 22;
gtk.enable = true;
x11.enable = true;
};
};
}

View file

@ -1,14 +0,0 @@
{ lib, ... }:
{
imports = [
./cursor.nix
./fonts.nix
./gtk.nix
./qt.nix
];
# settings to be expanded on in the future
options.homeModules.desktop.themeSettings = {
enable = lib.mkEnableOption "Enable theme settings";
};
}

View file

@ -1,24 +0,0 @@
{ pkgs, config, lib, ... }:
let
cfg = config.homeModules.desktop.themeSettings;
in
{
config = lib. mkIf cfg.enable {
fontProfiles = {
enable = true;
monospace = {
family = "JetBrainsMono Nerd Font";
package = pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; };
};
regular = {
family = "Fira Sans";
package = pkgs.fira;
};
};
home.packages = with pkgs; [
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
];
};
}

View file

@ -1,6 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
fonts = config.homeModules.theme.fonts;
cfg = config.homeModules.desktop.wayland.bar.waybar; cfg = config.homeModules.desktop.wayland.bar.waybar;
monitorWidth = (lib.head config.monitors).width - 20; monitorWidth = (lib.head config.monitors).width - 20;
inherit (config.colorscheme) colors; inherit (config.colorscheme) colors;
@ -78,7 +79,7 @@ in
}; };
style = /* css */ '' style = /* css */ ''
* { * {
font-family: "${config.fontProfiles.monospace.family}"; font-family: "${fonts.monospace.family}";
font-size: 19px; font-size: 19px;
border: solid #${colors.base05}; border: solid #${colors.base05};
} }

View file

@ -1,6 +1,7 @@
{ lib, config, pkgs, ... }: { lib, config, pkgs, ... }:
let let
fonts = config.homeModules.theme.fonts;
cfg = config.homeModules.desktop.wayland.launcher.rofi; cfg = config.homeModules.desktop.wayland.launcher.rofi;
in in
@ -8,7 +9,7 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.rofi = { programs.rofi = {
enable = true; enable = true;
font = "${config.fontProfiles.monospace.family}"; font = "${fonts.monospace.family}";
package = pkgs.rofi-wayland; package = pkgs.rofi-wayland;
terminal = "${config.home.sessionVariables.TERMINAL}"; terminal = "${config.home.sessionVariables.TERMINAL}";
theme = let theme = let
@ -24,7 +25,7 @@ in
background-color = mkLiteral "@background"; background-color = mkLiteral "@background";
border-color = mkLiteral "@foreground"; border-color = mkLiteral "@foreground";
text-color = mkLiteral "@foreground"; text-color = mkLiteral "@foreground";
font = mkLiteral "'${config.fontProfiles.monospace.family} 14'"; font = mkLiteral "'${fonts.monospace.family} 14'";
}; };
"window" = { "window" = {

View file

@ -2,6 +2,7 @@
let let
cfg = config.homeModules.desktop.wayland.launcher.tofi; cfg = config.homeModules.desktop.wayland.launcher.tofi;
fonts = config.homeModules.theme.fonts;
inherit (config.colorscheme) colors; inherit (config.colorscheme) colors;
in in
@ -24,7 +25,7 @@ in
result-spacing = 10 result-spacing = 10
selection-background-padding = 30 selection-background-padding = 30
prompt-padding = 10 prompt-padding = 10
font = "${config.fontProfiles.monospace.family}" font = "${fonts.monospace.family}"
font-size = 14 font-size = 14
prompt-text = " " prompt-text = " "
background-color = #0000 background-color = #0000

View file

@ -2,6 +2,7 @@
let let
cfg = config.homeModules.desktop.wayland.lockscreen.hyprlock; cfg = config.homeModules.desktop.wayland.lockscreen.hyprlock;
fonts = config.homeModules.theme.fonts;
inherit (config.colorscheme) colors; inherit (config.colorscheme) colors;
in in
@ -55,7 +56,7 @@ in
}; };
color = "0xff${colors.base08}"; color = "0xff${colors.base08}";
font_size = 30; font_size = 30;
font_family = "${config.fontProfiles.monospace.family}"; font_family = "${fonts.monospace.family}";
} }
{ {
monitor = ""; monitor = "";
@ -66,7 +67,7 @@ in
}; };
color = "0xff${colors.base0B}"; color = "0xff${colors.base0B}";
font_size = 20; font_size = 20;
font_family = "${config.fontProfiles.monospace.family}"; font_family = "${fonts.monospace.family}";
} }
]; ];
}; };

View file

@ -2,6 +2,8 @@
let let
inherit (config.colorscheme) colors; inherit (config.colorscheme) colors;
fonts = config.homeModules.theme.fonts;
wallpaperPath = config.homeModules.theme.wallpaper.path;
cfg = config.homeModules.desktop.wayland.lockscreen.swaylock; cfg = config.homeModules.desktop.wayland.lockscreen.swaylock;
in in
{ {
@ -10,8 +12,8 @@ in
programs.swaylock = { programs.swaylock = {
enable = true; enable = true;
settings = { settings = {
image = "${config.wallpaper}"; image = "${wallpaperPath}";
font = config.fontProfiles.monospace.family; font = fonts.monospace.family;
color = "#${colors.base01}"; color = "#${colors.base01}";
ring-color = "#${colors.base02}"; ring-color = "#${colors.base02}";
inside-wrong-color = "#${colors.base08}"; inside-wrong-color = "#${colors.base08}";

View file

@ -1,6 +1,7 @@
{ config, lib, ... }: { config, lib, ... }:
let let
inherit (config.colorscheme) colors kind; inherit (config.colorscheme) colors kind;
fonts = config.homeModules.theme.fonts;
cfg = config.homeModules.desktop.wayland.notification.mako; cfg = config.homeModules.desktop.wayland.notification.mako;
in { in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -11,7 +12,7 @@ in {
"${config.gtk.iconTheme.package}/share/icons/Papirus-Dark" "${config.gtk.iconTheme.package}/share/icons/Papirus-Dark"
else else
"${config.gtk.iconTheme.package}/share/icons/Papirus-Light"; "${config.gtk.iconTheme.package}/share/icons/Papirus-Light";
font = "${config.fontProfiles.regular.family} 12"; font = "${fonts.regular.family} 12";
padding = "10,10"; padding = "10,10";
anchor = "top-right"; anchor = "top-right";
width = 300; width = 300;

View file

@ -9,5 +9,6 @@
./misc.nix ./misc.nix
./monitor.nix ./monitor.nix
./gestures.nix ./gestures.nix
./hyprpaper.nix
]; ];
} }

View file

@ -9,13 +9,10 @@ in
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {
exec = [ exec = [
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
"${pkgs.swaybg}/bin/swaybg -i ${config.wallpaper} --mode fill"
]; ];
exec-once = [ exec-once = [
"${pkgs._1password-gui}/bin/1password --silent" "${pkgs._1password-gui}/bin/1password --silent"
"${pkgs.live-buds-cli}/bin/earbuds -d" "${pkgs.live-buds-cli}/bin/earbuds -d"
"eww daemon && eww open bar"
"systemctl --user start clight"
"waybar" "waybar"
]; ];
}; };

View file

@ -0,0 +1,19 @@
{ lib, config, inputs, ... }:
let
cfg = config.homeModules.desktop.wayland.windowManager.hyprland;
wallpaperPath = config.homeModules.theme.wallpaper.path;
in
{
imports = [ inputs.hyprpaper.homeManagerModules.hyprpaper ];
config = lib.mkIf cfg.enable {
services.hyprpaper = {
enable = true;
preloads = ["${wallpaperPath}"];
wallpapers = [", ${wallpaperPath}"];
ipc = false;
};
};
}

View file

@ -0,0 +1,38 @@
{ lib, config, ... }:
let
cfg = config.homeModules.theme.cursor;
in
{
options.homeModules.theme.cursor = {
enable = lib.mkEnableOption "Enable cursor module";
package = lib.mkOption {
type = lib.types.package;
default = null;
description = "Package for cursor";
example = "pkgs.bibata-cursors";
};
name = lib.mkOption {
type = lib.types.str;
default = "";
description = "Name of cursor";
example = "Bibata-Modern-Ice";
};
size = lib.mkOption {
type = lib.types.int;
default = 22;
description = "Size of cursor";
example = "22";
};
};
config = lib.mkIf cfg.enable {
home.pointerCursor = {
package = cfg.package;
name = cfg.name;
size = cfg.size;
gtk.enable = true;
x11.enable = true;
};
};
}

View file

@ -0,0 +1,9 @@
{
imports = [
./fonts
./cursor
./gtk
./qt
./wallpaper
];
}

View file

@ -1,10 +1,10 @@
{ lib, config, ... }: { lib, config, pkgs, ... }:
let let
mkFontOption = kind: { mkFontOption = kind: {
family = lib.mkOption { family = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = null; default = "";
description = "Family name for ${kind} font profile"; description = "Family name for ${kind} font profile";
example = "Fira Code"; example = "Fira Code";
}; };
@ -15,10 +15,10 @@ let
example = "pkgs.fira-code"; example = "pkgs.fira-code";
}; };
}; };
cfg = config.fontProfiles; cfg = config.homeModules.theme.fonts;
in in
{ {
options.fontProfiles = { options.homeModules.theme.fonts = {
enable = lib.mkEnableOption "Whether to enable font profiles"; enable = lib.mkEnableOption "Whether to enable font profiles";
monospace = mkFontOption "monospace"; monospace = mkFontOption "monospace";
regular = mkFontOption "regular"; regular = mkFontOption "regular";
@ -27,6 +27,14 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
home.packages = [ cfg.monospace.package cfg.regular.package ]; home.packages = [
cfg.monospace.package
cfg.regular.package
pkgs.noto-fonts
pkgs.noto-fonts-cjk
pkgs.noto-fonts-emoji
];
}; };
} }

View file

@ -2,14 +2,19 @@
let let
inherit (inputs.nix-colors.lib-contrib { inherit pkgs; }) gtkThemeFromScheme; inherit (inputs.nix-colors.lib-contrib { inherit pkgs; }) gtkThemeFromScheme;
cfg = config.homeModules.desktop.themeSettings; cfg = config.homeModules.theme.gtk;
in in
{ {
options.homeModules.theme.gtk = {
enable = lib.mkEnableOption "Enable gtk theme module";
# TODO: add theme option
};
config = lib.mkIf cfg.enable (rec { config = lib.mkIf cfg.enable (rec {
gtk = { gtk = {
enable = true; enable = true;
font = { font = {
name = config.fontProfiles.regular.family; name = config.homeModules.theme.fonts.regular.family;
size = 12; size = 12;
}; };
theme = { theme = {
@ -33,3 +38,4 @@ in
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
}); });
} }

View file

@ -1,8 +1,10 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.homeModules.desktop.themeSettings; cfg = config.homeModules.theme.qt;
in in
{ {
options.homeModules.theme.qt.enable = lib.mkEnableOption "Enable qt module";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
qt = { qt = {
enable = true; enable = true;
@ -10,3 +12,4 @@ in
}; };
}; };
} }

View file

@ -1,25 +1,28 @@
{ lib, config, inputs, pkgs, ... }: { lib, config, inputs, pkgs, ... }:
let let
cfg = config.homeModules.config.nixColors;
inherit (inputs.nix-colors) colorSchemes;
inherit (inputs.nix-colors.lib-contrib { inherit pkgs; }) nixWallpaperFromScheme; inherit (inputs.nix-colors.lib-contrib { inherit pkgs; }) nixWallpaperFromScheme;
inherit (lib) types mkDefault mkIf mkOption mkEnableOption;
cfg = config.homeModules.theme.wallpaper;
in in
{ {
imports = [ inputs.nix-colors.homeManagerModule ]; options.homeModules.theme.wallpaper = {
enable = mkEnableOption "Enable wallpaper module";
path = mkOption {
type = types.path;
default = null;
description = "Wallpaper Path";
};
};
config = lib.mkIf cfg.enable { config = mkIf cfg.enable {
colorscheme = lib.mkDefault colorSchemes.gruvbox-material-dark-soft; homeModules.theme.wallpaper.path =
home.file.".colorscheme".text = config.colorscheme.slug;
wallpaper =
let let
largest = f: xs: builtins.head (builtins.sort (a: b: a > b) (map f xs)); largest = f: xs: builtins.head (builtins.sort (a: b: a > b) (map f xs));
largestWidth = largest (x: x.width) config.monitors; largestWidth = largest (x: x.width) config.monitors;
largestHeight = largest (x: x.height) config.monitors; largestHeight = largest (x: x.height) config.monitors;
in in
lib.mkDefault (nixWallpaperFromScheme mkDefault (nixWallpaperFromScheme
{ {
scheme = config.colorscheme; scheme = config.colorscheme;
width = largestWidth; width = largestWidth;
@ -28,3 +31,4 @@ in
}); });
}; };
} }

View file

@ -15,7 +15,7 @@ in
config = { config = {
nix.enable = true; nix.enable = true;
nixColors.enable = true; # nixColors.enable = true;
home.enable = true; home.enable = true;
userDirs.enable = true; userDirs.enable = true;
mimeApps.enable = true; mimeApps.enable = true;

View file

@ -13,6 +13,7 @@ in
#./creative #./creative
./productivity ./productivity
./gaming ./gaming
./themes
]; ];
options = { options = {

View file

@ -54,8 +54,6 @@ in
youtube.enable = true; youtube.enable = true;
}; };
}; };
themeSettings.enable = true;
}; };
}; };
} }

View file

@ -0,0 +1,27 @@
{ lib, config, ... }:
# let
# cfg = config.theme;
# in
{
imports = [
./minimal
];
options.theme = {
minimal.enable = lib.mkEnableOption "enable minimal theme";
};
# config = {
# assertions = [
# {
# assertion =
# (lib.length (lib.filter (x: x) [
# cfg.minimal or false
# cfg.OTHERTHEMEHERE or false
# ]) <= 1);
# }
# ];
# };
}

View file

@ -0,0 +1,42 @@
{ lib, config, pkgs, inputs, ... }:
let
cfg = config.theme.minimal;
inherit (inputs.nix-colors) colorSchemes;
in
{
imports = [ inputs.nix-colors.homeManagerModule ];
config = lib.mkIf cfg.enable {
colorscheme = colorSchemes.gruvbox-material-dark-soft;
home.file.".colorscheme".text = config.colorscheme.slug;
home.sessionVariables.COLOR_SCHEME = "${config.colorscheme.slug}";
homeModules.theme = {
fonts.enable = true;
fonts.regular = {
family = "Fira Sans";
package = pkgs.fira;
};
fonts.monospace = {
family = "JetBrainsMono Nerd Font";
package = pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; };
};
cursor.enable = true;
cursor = {
name = "Bibata-Modern-Ice";
package = pkgs.bibata-cursors;
size = 22;
};
wallpaper = {
enable = true;
};
gtk.enable = true;
qt.enable = true;
};
};
}

View file

@ -7,6 +7,8 @@
activeProfiles = ["base" "hyprland" "productivity" "gaming"]; activeProfiles = ["base" "hyprland" "productivity" "gaming"];
theme = "minimal";
home.sessionVariables.HN = "ooksdesk"; home.sessionVariables.HN = "ooksdesk";
homeModules.desktop.wayland.nvidia = true; homeModules.desktop.wayland.nvidia = true;

View file

@ -7,6 +7,8 @@
activeProfiles = ["base" "hyprland" "productivity"]; activeProfiles = ["base" "hyprland" "productivity"];
theme.minimal.enable = true;
home.sessionVariables.HN = "ookst480s"; home.sessionVariables.HN = "ookst480s";
monitors = [{ monitors = [{
@ -17,7 +19,5 @@
primary = true; primary = true;
transform = 0; transform = 0;
}]; }];
colorscheme = inputs.nix-colors.colorSchemes.gruvbox-material-dark-soft;
} }