feat: better theming

This commit is contained in:
2024-04-29 16:00:54 +02:00
parent ced84cf07a
commit 667469c0ce
8 changed files with 171 additions and 107 deletions

View File

@@ -49,7 +49,7 @@
}; };
}; };
theming.matugen.enable = true; theming.md3-evo.enable = true;
shell.components = { shell.components = {
waybar.enable = true; waybar.enable = true;
dunst.enable = true; dunst.enable = true;

View File

@@ -13,9 +13,6 @@
enable = true; enable = true;
variables = [ "--all" ]; variables = [ "--all" ];
}; };
extraConfig = ''
source=./theme.conf
'';
settings = { settings = {
env = [ env = [
"XDG_SESSION_TYPE,wayland" "XDG_SESSION_TYPE,wayland"
@@ -26,16 +23,10 @@
exec-once = [ exec-once = [
"gnome-keyring-daemon --start --components=secrets" "gnome-keyring-daemon --start --components=secrets"
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
"${pkgs.swww}/bin/swww-daemon"
"theme init"
]; ];
general = { general = {
layout = "master"; layout = "master";
resize_on_border = true; resize_on_border = true;
extend_border_grab_area = 4;
border_size = 1;
gaps_in = 12;
gaps_out = 24;
}; };
master = { master = {
orientation = "center"; orientation = "center";
@@ -100,21 +91,9 @@
"ignorealpha 0.3, anyrun" "ignorealpha 0.3, anyrun"
]; ];
decoration = { decoration = {
rounding = 24;
drop_shadow = "yes"; drop_shadow = "yes";
shadow_range = 16; shadow_range = 16;
"col.shadow" = "rgba(00000044)"; "col.shadow" = "rgba(00000044)";
dim_inactive = false;
blur = {
enabled = true;
size = 8;
passes = 3;
noise = 1.0e-2;
contrast = 0.9;
brightness = 0.8;
};
}; };
animations = { animations = {
enabled = "yes"; enabled = "yes";

View File

@@ -8,8 +8,6 @@
font_size 13 font_size 13
''; '';
settings = { settings = {
background_opacity = "0.8";
background_tint = "0.0";
window_padding_width = 10; window_padding_width = 10;
}; };
} }

View File

@@ -4,15 +4,6 @@
defaultEditor = true; defaultEditor = true;
vimAlias = true; vimAlias = true;
colorscheme = "matugen";
autoCmd = [
{
event = [ "Signal" ];
pattern = [ "SIGUSR1" ];
command = "colorscheme matugen";
}
];
opts = { opts = {
number = true; number = true;
relativenumber = true; relativenumber = true;
@@ -31,8 +22,6 @@
scrolloff = 12; scrolloff = 12;
termguicolors = true;
hlsearch = false; hlsearch = false;
incsearch = true; incsearch = true;

View File

@@ -1,4 +1,17 @@
general { general {
col.inactive_border = rgba({{colors.surface.default.hex_stripped}}cc) col.inactive_border = rgba({{colors.surface.default.hex_stripped}}{{custom.transparency_hex | to_lower}})
col.active_border = rgb({{colors.primary.default.hex_stripped}}) col.active_border = rgb({{colors.primary.default.hex_stripped}})
border_size = 1
extend_border_grab_area = 4
gaps_in = {{custom.padding}}
gaps_out = {{custom.double_padding}}
}
decoration {
rounding = {{custom.radius}}
blur {
size = {{custom.blur}}
passes = 2
}
} }

View File

@@ -1,3 +1,6 @@
background_tint 0.0
background_opacity {{custom.transparency}}
background {{colors.surface.default.hex}} background {{colors.surface.default.hex}}
foreground {{colors.on_surface.default.hex}} foreground {{colors.on_surface.default.hex}}

View File

@@ -5,18 +5,56 @@
username, username,
... ...
}: }:
with lib;
let let
cfg = config.theming.matugen; cfg = config.theming.md3-evo;
homeCfg = config.home-manager.users.${username}; homeCfg = config.home-manager.users.${username};
in in
{ {
options.theming.matugen = { options.theming.md3-evo = {
enable = mkEnableOption "Enable dynamic theming through matugen"; enable = lib.mkEnableOption "the MD3-EVO theme";
flavour = lib.mkOption {
type = lib.types.enum [
"content"
"expressive"
"fidelity"
"fruit-salad"
"monochrome"
"neutral"
"rainbow"
"tonal-spot"
];
default = "content";
description = "The flavour of the theme";
};
contrast = lib.mkOption {
type = lib.types.numbers.between (-1) 1;
default = 0;
description = "Use a modified contrast";
};
transparency = lib.mkOption {
type = lib.types.numbers.between 0 1;
default = 0.8;
description = "The transparency of apps";
};
radius = lib.mkOption {
type = lib.types.ints.positive;
default = 24;
description = "The radius of the corners";
};
padding = lib.mkOption {
type = lib.types.ints.positive;
default = 12;
description = "The padding of the windows";
};
blur = lib.mkOption {
type = lib.types.ints.positive;
default = 16;
description = "The blur amount of windows";
};
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment = { environment = {
systemPackages = [ systemPackages = [
pkgs.adw-gtk3 pkgs.adw-gtk3
@@ -77,7 +115,7 @@ in
GTK_THEME="adw-gtk3-dark" GTK_THEME="adw-gtk3-dark"
fi fi
matugen image "$WALLPAPER" --mode "$MODE" matugen image "$WALLPAPER" --type scheme-${cfg.flavour} --contrast ${builtins.toString cfg.contrast} --mode "$MODE"
sed -i "s/set background=dark/set background=$MODE/g" ${homeCfg.xdg.configHome}/nvim/colors/matugen.vim sed -i "s/set background=dark/set background=$MODE/g" ${homeCfg.xdg.configHome}/nvim/colors/matugen.vim
dconf write /org/gnome/desktop/interface/gtk-theme "'$GTK_THEME'" dconf write /org/gnome/desktop/interface/gtk-theme "'$GTK_THEME'"
@@ -96,75 +134,119 @@ in
}; };
home-manager.users.${username} = { home-manager.users.${username} = {
programs.kitty.extraConfig = '' programs.kitty = {
include ${homeCfg.xdg.configHome}/kitty/theme.conf extraConfig = ''
''; include ${homeCfg.xdg.configHome}/kitty/theme.conf
'';
};
programs.nixvim = {
opts.termguicolors = true;
colorscheme = "md3-evo";
autoCmd = [
{
event = [ "Signal" ];
pattern = [ "SIGUSR1" ];
command = "colorscheme matugen";
}
];
};
gtk = { gtk = {
gtk3.extraCss = "@import './theme.css';"; gtk3.extraCss = "@import './theme.css';";
gtk4.extraCss = "@import './theme.css';"; gtk4.extraCss = "@import './theme.css';";
}; };
xdg.configFile."matugen/config.toml".source = (pkgs.formats.toml { }).generate "matugen" { wayland.windowManager.hyprland = {
config = { settings.exec-once = [
reload_apps = true; "${pkgs.swww}/bin/swww-daemon"
reload_apps_list = { "theme init"
kitty = homeCfg.programs.kitty.enable; ];
waybar = false; extraConfig = ''
dunst = homeCfg.services.dunst.enable; source=./theme.conf
}; '';
};
set_wallpaper = true; xdg.configFile."matugen/config.toml" = {
wallpaper_tool = "Swww"; onChange = ''
theme init
custom_colors = { '';
red = "#ff0000"; source = (pkgs.formats.toml { }).generate "matugen" {
green = "#00ff00"; config = {
yellow = "#ffff00"; reload_apps = true;
orange = "#ff8000"; reload_apps_list = {
blue = "#0000ff"; kitty = homeCfg.programs.kitty.enable;
magenta = "#ff00ff"; waybar = false;
cyan = "#00ffff"; dunst = homeCfg.services.dunst.enable;
warn = {
color = "#ffff00";
blend = false;
}; };
ok = {
color = "#00ff00"; set_wallpaper = true;
blend = false; wallpaper_tool = "Swww";
custom_colors = {
red = "#ff0000";
green = "#00ff00";
yellow = "#ffff00";
orange = "#ff8000";
blue = "#0000ff";
magenta = "#ff00ff";
cyan = "#00ffff";
warn = {
color = "#ffff00";
blend = false;
};
ok = {
color = "#00ff00";
blend = false;
};
};
custom_keywords = {
padding = builtins.toString cfg.padding;
double_padding = builtins.toString (cfg.padding * 2);
radius = builtins.toString cfg.radius;
transparency = builtins.toString cfg.transparency;
blur = builtins.toString cfg.blur;
flavour = cfg.flavour;
contrast = builtins.toString cfg.contrast;
transparency_hex =
let
zeroPad = hex: if builtins.stringLength hex == 1 then "0${hex}" else hex;
in
zeroPad (lib.trivial.toHexString (builtins.floor (cfg.transparency * 255)));
}; };
}; };
};
templates = { templates = {
kitty = { kitty = {
input_path = ./kitty.conf; input_path = ./kitty.conf;
output_path = "${homeCfg.xdg.configHome}/kitty/theme.conf"; output_path = "${homeCfg.xdg.configHome}/kitty/theme.conf";
}; };
nvim = { nvim = {
input_path = ./nvim.vim; input_path = ./nvim.vim;
output_path = "${homeCfg.xdg.configHome}/nvim/colors/matugen.vim"; output_path = "${homeCfg.xdg.configHome}/nvim/colors/md3-evo.vim";
}; };
hyprland = { hyprland = {
input_path = ./hyprland.conf; input_path = ./hyprland.conf;
output_path = "${homeCfg.xdg.configHome}/hypr/theme.conf"; output_path = "${homeCfg.xdg.configHome}/hypr/theme.conf";
}; };
anyrun = { anyrun = {
input_path = ./anyrun.css; input_path = ./anyrun.css;
output_path = "${homeCfg.xdg.configHome}/anyrun/theme.css"; output_path = "${homeCfg.xdg.configHome}/anyrun/theme.css";
}; };
gtk3 = { gtk3 = {
input_path = ./gtk.css; input_path = ./gtk.css;
output_path = "${homeCfg.xdg.configHome}/gtk-3.0/theme.css"; output_path = "${homeCfg.xdg.configHome}/gtk-3.0/theme.css";
}; };
gtk4 = { gtk4 = {
input_path = ./gtk.css; input_path = ./gtk.css;
output_path = "${homeCfg.xdg.configHome}/gtk-4.0/theme.css"; output_path = "${homeCfg.xdg.configHome}/gtk-4.0/theme.css";
}; };
vesktop = { vesktop = {
input_path = ./discord.css; input_path = ./discord.css;
output_path = "${homeCfg.xdg.configHome}/vesktop/themes/matugen.theme.css"; output_path = "${homeCfg.xdg.configHome}/vesktop/themes/matugen.theme.css";
};
}; };
}; };
}; };

View File

@@ -1,12 +1,12 @@
set background=dark set background=dark
let g:neovide_transparency = 0.8 let g:neovide_transparency = {{custom.transparency}}
let g:neovide_padding_top = 12 let g:neovide_padding_top = {{custom.padding}}
let g:neovide_padding_bottom = 12 let g:neovide_padding_bottom = {{custom.padding}}
let g:neovide_padding_left = 12 let g:neovide_padding_left = {{custom.padding}}
let g:neovide_padding_right = 12 let g:neovide_padding_right = {{custom.padding}}
let g:neovide_floating_blur_amount_x = 16 let g:neovide_floating_blur_amount_x = {{custom.blur}}
let g:neovide_floating_blur_amount_y = 16 let g:neovide_floating_blur_amount_y = {{custom.blur}}
let g:neovide_floating_shadow = 0 let g:neovide_floating_shadow = 0
if exists("g:neovide") if exists("g:neovide")