mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2026-01-23 01:52:46 +00:00
use hm module for matugen
This commit is contained in:
8
flake.lock
generated
8
flake.lock
generated
@@ -220,16 +220,16 @@
|
|||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1714402324,
|
"lastModified": 1714427480,
|
||||||
"narHash": "sha256-VVT4K/r7REVT1g/UF7xgpCuR9h61q9KG1KW1BbbT7YA=",
|
"narHash": "sha256-m6iICMLTIfcD6BQMR03Y946f+tmb6pseew+ZVwqY/YI=",
|
||||||
"owner": "Theaninova",
|
"owner": "Theaninova",
|
||||||
"repo": "matugen",
|
"repo": "matugen",
|
||||||
"rev": "6bbb7a6e8047f27c35f6c69b8de1c3a59b87b6cd",
|
"rev": "1d4cb4ee1b407df5cb9eec89e54a8e9912ea5a5b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "Theaninova",
|
"owner": "Theaninova",
|
||||||
"ref": "custom-color-support",
|
"ref": "add-home-manager-module",
|
||||||
"repo": "matugen",
|
"repo": "matugen",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
url = "github:nix-community/home-manager";
|
url = "github:nix-community/home-manager";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
matugen.url = "github:Theaninova/matugen/custom-color-support";
|
matugen.url = "github:Theaninova/matugen/add-home-manager-module";
|
||||||
nixvim = {
|
nixvim = {
|
||||||
url = "github:nix-community/nixvim";
|
url = "github:nix-community/nixvim";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
@@ -77,6 +77,7 @@
|
|||||||
};
|
};
|
||||||
users.${username} = {
|
users.${username} = {
|
||||||
imports = [
|
imports = [
|
||||||
|
matugen.homeManagerModules.default
|
||||||
./modules/home-manager
|
./modules/home-manager
|
||||||
./hosts/${hostname}/home.nix
|
./hosts/${hostname}/home.nix
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -49,7 +49,6 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
theming.md3-evo.enable = true;
|
|
||||||
shell.components = {
|
shell.components = {
|
||||||
waybar.enable = true;
|
waybar.enable = true;
|
||||||
dunst.enable = true;
|
dunst.enable = true;
|
||||||
|
|||||||
@@ -1 +1,4 @@
|
|||||||
{ ... }: { }
|
{ ... }:
|
||||||
|
{
|
||||||
|
theme.md3-evo.enable = true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
./packages
|
./packages
|
||||||
./programs
|
./programs
|
||||||
./services
|
./services
|
||||||
|
./theme/md3-evo.nix
|
||||||
./desktops/hyprland
|
./desktops/hyprland
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 3.6 MiB After Width: | Height: | Size: 3.6 MiB |
374
modules/home-manager/theme/md3-evo.nix
Normal file
374
modules/home-manager/theme/md3-evo.nix
Normal file
@@ -0,0 +1,374 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.theme.md3-evo;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.theme.md3-evo = {
|
||||||
|
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 = "tonal-spot";
|
||||||
|
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";
|
||||||
|
};
|
||||||
|
semantic = {
|
||||||
|
blend = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Blend the colors";
|
||||||
|
};
|
||||||
|
danger = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#ff0000";
|
||||||
|
description = "The color of danger";
|
||||||
|
};
|
||||||
|
warning = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#ffff00";
|
||||||
|
description = "The color of warning";
|
||||||
|
};
|
||||||
|
success = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#00ff00";
|
||||||
|
description = "The color of success";
|
||||||
|
};
|
||||||
|
info = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#0000ff";
|
||||||
|
description = "The color of info";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
syntax = {
|
||||||
|
blend = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Blend the colors";
|
||||||
|
};
|
||||||
|
keywords = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#ff8000";
|
||||||
|
description = "The color of keywords";
|
||||||
|
};
|
||||||
|
functions = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#0000ff";
|
||||||
|
description = "The color of functions";
|
||||||
|
};
|
||||||
|
properties = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#ff00ff";
|
||||||
|
description = "The color of properties";
|
||||||
|
};
|
||||||
|
constants = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#ff00ff";
|
||||||
|
description = "The color of constants";
|
||||||
|
};
|
||||||
|
strings = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#00ff00";
|
||||||
|
description = "The color of variables";
|
||||||
|
};
|
||||||
|
numbers = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#00ffff";
|
||||||
|
description = "The color of numbers";
|
||||||
|
};
|
||||||
|
structures = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#ffff00";
|
||||||
|
description = "The color of structures";
|
||||||
|
};
|
||||||
|
types = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#00ffff";
|
||||||
|
description = "The color of types";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
ansi = {
|
||||||
|
blend = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Blend the colors";
|
||||||
|
};
|
||||||
|
red = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#ff0000";
|
||||||
|
description = "The color of red";
|
||||||
|
};
|
||||||
|
green = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#00ff00";
|
||||||
|
description = "The color of green";
|
||||||
|
};
|
||||||
|
yellow = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#ffff00";
|
||||||
|
description = "The color of yellow";
|
||||||
|
};
|
||||||
|
orange = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#ff8000";
|
||||||
|
description = "The color of orange";
|
||||||
|
};
|
||||||
|
blue = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#0000ff";
|
||||||
|
description = "The color of blue";
|
||||||
|
};
|
||||||
|
magenta = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#ff00ff";
|
||||||
|
description = "The color of magenta";
|
||||||
|
};
|
||||||
|
cyan = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "#00ffff";
|
||||||
|
description = "The color of cyan";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
home.packages = [
|
||||||
|
pkgs.adw-gtk3
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "theme";
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.matugen
|
||||||
|
pkgs.swww
|
||||||
|
pkgs.gnome.zenity
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
WALLPAPER=${config.xdg.configHome}/matugen/wallpaper
|
||||||
|
|
||||||
|
SCHEME=$(dconf read /org/gnome/desktop/interface/color-scheme)
|
||||||
|
if [ "$SCHEME" = "'prefer-light'" ]; then
|
||||||
|
MODE="light"
|
||||||
|
else
|
||||||
|
MODE="dark"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo -e "\033[1mUsage:\033[0m mode|light|dark|toggle|wallpaper"
|
||||||
|
exit 1
|
||||||
|
elif [ "$1" = "mode" ]; then
|
||||||
|
echo -e "$MODE"
|
||||||
|
exit 0
|
||||||
|
elif [ "$1" = "wallpaper" ]; then
|
||||||
|
if [ $# -eq 1 ]; then
|
||||||
|
PICKED=$(zenity --file-selection --file-filter='Images | *.png *.jpg *.jpeg *.svg *.bmp *.gif')
|
||||||
|
cp "$PICKED" "$WALLPAPER"
|
||||||
|
else
|
||||||
|
cp "$2" "$WALLPAPER"
|
||||||
|
fi
|
||||||
|
elif [ "$1" = "toggle" ]; then
|
||||||
|
if [ "$MODE" = "light" ]; then
|
||||||
|
MODE="dark"
|
||||||
|
else
|
||||||
|
MODE="light"
|
||||||
|
fi
|
||||||
|
elif [ "$1" = "light" ] || [ "$1" = "dark" ]; then
|
||||||
|
MODE="$1"
|
||||||
|
elif [ "$1" = "init" ]; then
|
||||||
|
echo -e "\033[1mSetting up matugen\033[0m"
|
||||||
|
else
|
||||||
|
echo -e "\033[31mInvalid argument\033[0m"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f $WALLPAPER ]; then
|
||||||
|
echo -e "\033[31,1mNo wallpaper set\033[0m"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$MODE" = "light" ]; then
|
||||||
|
GTK_THEME="adw-gtk3"
|
||||||
|
else
|
||||||
|
GTK_THEME="adw-gtk3-dark"
|
||||||
|
fi
|
||||||
|
|
||||||
|
matugen image "$WALLPAPER" --type scheme-${cfg.flavour} --contrast ${builtins.toString cfg.contrast} --mode "$MODE"
|
||||||
|
sed -i "s/set background=dark/set background=$MODE/g" ${config.xdg.configHome}/nvim/colors/md3-evo.vim
|
||||||
|
|
||||||
|
dconf write /org/gnome/desktop/interface/gtk-theme "'$GTK_THEME'"
|
||||||
|
dconf write /org/gnome/desktop/interface/color-scheme "'prefer-$MODE'"
|
||||||
|
|
||||||
|
if command -v hyprctl &> /dev/null; then
|
||||||
|
hyprctl reload
|
||||||
|
fi
|
||||||
|
|
||||||
|
for i in $(pgrep -u "$USER" -x nvim); do
|
||||||
|
kill -USR1 "$i"
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.kitty = {
|
||||||
|
extraConfig = ''
|
||||||
|
include ${config.xdg.configHome}/kitty/theme.conf
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.nixvim = {
|
||||||
|
opts.termguicolors = true;
|
||||||
|
colorscheme = "md3-evo";
|
||||||
|
autoCmd = [
|
||||||
|
{
|
||||||
|
event = [ "Signal" ];
|
||||||
|
pattern = [ "SIGUSR1" ];
|
||||||
|
command = "colorscheme md3-evo";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
gtk = {
|
||||||
|
gtk3.extraCss = "@import './theme.css';";
|
||||||
|
gtk4.extraCss = "@import './theme.css';";
|
||||||
|
};
|
||||||
|
|
||||||
|
wayland.windowManager.hyprland = {
|
||||||
|
settings.exec-once = [
|
||||||
|
"${pkgs.swww}/bin/swww-daemon"
|
||||||
|
"theme init"
|
||||||
|
];
|
||||||
|
extraConfig = ''
|
||||||
|
source=./theme.conf
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.matugen = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
config = {
|
||||||
|
reload_apps = true;
|
||||||
|
reload_apps_list = {
|
||||||
|
kitty = config.programs.kitty.enable;
|
||||||
|
waybar = false;
|
||||||
|
dunst = config.services.dunst.enable;
|
||||||
|
};
|
||||||
|
|
||||||
|
set_wallpaper = true;
|
||||||
|
wallpaper_tool = "Swww";
|
||||||
|
|
||||||
|
custom_colors =
|
||||||
|
let
|
||||||
|
mkColor = category: color: {
|
||||||
|
color = cfg.${category}.${color};
|
||||||
|
blend = cfg.${category}.blend;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
red = mkColor "ansi" "red";
|
||||||
|
green = mkColor "ansi" "green";
|
||||||
|
yellow = mkColor "ansi" "yellow";
|
||||||
|
orange = mkColor "ansi" "orange";
|
||||||
|
blue = mkColor "ansi" "blue";
|
||||||
|
magenta = mkColor "ansi" "magenta";
|
||||||
|
cyan = mkColor "ansi" "cyan";
|
||||||
|
|
||||||
|
keywords = mkColor "syntax" "keywords";
|
||||||
|
functions = mkColor "syntax" "functions";
|
||||||
|
constants = mkColor "syntax" "constants";
|
||||||
|
properties = mkColor "syntax" "properties";
|
||||||
|
strings = mkColor "syntax" "strings";
|
||||||
|
numbers = mkColor "syntax" "numbers";
|
||||||
|
structures = mkColor "syntax" "structures";
|
||||||
|
types = mkColor "syntax" "types";
|
||||||
|
|
||||||
|
danger = mkColor "semantic" "danger";
|
||||||
|
warning = mkColor "semantic" "warning";
|
||||||
|
success = mkColor "semantic" "success";
|
||||||
|
info = mkColor "semantic" "info";
|
||||||
|
};
|
||||||
|
|
||||||
|
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 = {
|
||||||
|
kitty = {
|
||||||
|
input_path = ./kitty.conf;
|
||||||
|
output_path = "${config.xdg.configHome}/kitty/theme.conf";
|
||||||
|
};
|
||||||
|
nvim = {
|
||||||
|
input_path = ./nvim.vim;
|
||||||
|
output_path = "${config.xdg.configHome}/nvim/colors/md3-evo.vim";
|
||||||
|
};
|
||||||
|
hyprland = {
|
||||||
|
input_path = ./hyprland.conf;
|
||||||
|
output_path = "${config.xdg.configHome}/hypr/theme.conf";
|
||||||
|
};
|
||||||
|
anyrun = {
|
||||||
|
input_path = ./anyrun.css;
|
||||||
|
output_path = "${config.xdg.configHome}/anyrun/theme.css";
|
||||||
|
};
|
||||||
|
gtk3 = {
|
||||||
|
input_path = ./gtk.css;
|
||||||
|
output_path = "${config.xdg.configHome}/gtk-3.0/theme.css";
|
||||||
|
};
|
||||||
|
gtk4 = {
|
||||||
|
input_path = ./gtk.css;
|
||||||
|
output_path = "${config.xdg.configHome}/gtk-4.0/theme.css";
|
||||||
|
};
|
||||||
|
vesktop = {
|
||||||
|
input_path = ./discord.css;
|
||||||
|
output_path = "${config.xdg.configHome}/vesktop/themes/matugen.theme.css";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -22,8 +22,6 @@
|
|||||||
|
|
||||||
./locales/theaninova.nix
|
./locales/theaninova.nix
|
||||||
|
|
||||||
./theming/md3-evo.nix
|
|
||||||
|
|
||||||
./usecases/gaming.nix
|
./usecases/gaming.nix
|
||||||
./usecases/3d-printing.nix
|
./usecases/3d-printing.nix
|
||||||
./usecases/development.nix
|
./usecases/development.nix
|
||||||
|
|||||||
@@ -1,385 +0,0 @@
|
|||||||
{
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
username,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.theming.md3-evo;
|
|
||||||
homeCfg = config.home-manager.users.${username};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.theming.md3-evo = {
|
|
||||||
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 = "tonal-spot";
|
|
||||||
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";
|
|
||||||
};
|
|
||||||
semantic = {
|
|
||||||
blend = lib.mkOption {
|
|
||||||
type = lib.types.bool;
|
|
||||||
default = false;
|
|
||||||
description = "Blend the colors";
|
|
||||||
};
|
|
||||||
danger = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#ff0000";
|
|
||||||
description = "The color of danger";
|
|
||||||
};
|
|
||||||
warning = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#ffff00";
|
|
||||||
description = "The color of warning";
|
|
||||||
};
|
|
||||||
success = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#00ff00";
|
|
||||||
description = "The color of success";
|
|
||||||
};
|
|
||||||
info = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#0000ff";
|
|
||||||
description = "The color of info";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
syntax = {
|
|
||||||
blend = lib.mkOption {
|
|
||||||
type = lib.types.bool;
|
|
||||||
default = true;
|
|
||||||
description = "Blend the colors";
|
|
||||||
};
|
|
||||||
keywords = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#ff8000";
|
|
||||||
description = "The color of keywords";
|
|
||||||
};
|
|
||||||
functions = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#0000ff";
|
|
||||||
description = "The color of functions";
|
|
||||||
};
|
|
||||||
properties = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#ff00ff";
|
|
||||||
description = "The color of properties";
|
|
||||||
};
|
|
||||||
constants = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#ff00ff";
|
|
||||||
description = "The color of constants";
|
|
||||||
};
|
|
||||||
strings = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#00ff00";
|
|
||||||
description = "The color of variables";
|
|
||||||
};
|
|
||||||
numbers = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#00ffff";
|
|
||||||
description = "The color of numbers";
|
|
||||||
};
|
|
||||||
structures = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#ffff00";
|
|
||||||
description = "The color of structures";
|
|
||||||
};
|
|
||||||
types = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#00ffff";
|
|
||||||
description = "The color of types";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
ansi = {
|
|
||||||
blend = lib.mkOption {
|
|
||||||
type = lib.types.bool;
|
|
||||||
default = true;
|
|
||||||
description = "Blend the colors";
|
|
||||||
};
|
|
||||||
red = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#ff0000";
|
|
||||||
description = "The color of red";
|
|
||||||
};
|
|
||||||
green = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#00ff00";
|
|
||||||
description = "The color of green";
|
|
||||||
};
|
|
||||||
yellow = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#ffff00";
|
|
||||||
description = "The color of yellow";
|
|
||||||
};
|
|
||||||
orange = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#ff8000";
|
|
||||||
description = "The color of orange";
|
|
||||||
};
|
|
||||||
blue = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#0000ff";
|
|
||||||
description = "The color of blue";
|
|
||||||
};
|
|
||||||
magenta = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#ff00ff";
|
|
||||||
description = "The color of magenta";
|
|
||||||
};
|
|
||||||
cyan = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "#00ffff";
|
|
||||||
description = "The color of cyan";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
environment = {
|
|
||||||
systemPackages = [
|
|
||||||
pkgs.adw-gtk3
|
|
||||||
pkgs.matugen
|
|
||||||
(pkgs.writeShellApplication {
|
|
||||||
name = "theme";
|
|
||||||
runtimeInputs = [
|
|
||||||
pkgs.matugen
|
|
||||||
pkgs.swww
|
|
||||||
pkgs.gnome.zenity
|
|
||||||
];
|
|
||||||
text = ''
|
|
||||||
WALLPAPER=${homeCfg.xdg.configHome}/matugen/wallpaper
|
|
||||||
|
|
||||||
SCHEME=$(dconf read /org/gnome/desktop/interface/color-scheme)
|
|
||||||
if [ "$SCHEME" = "'prefer-light'" ]; then
|
|
||||||
MODE="light"
|
|
||||||
else
|
|
||||||
MODE="dark"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
echo -e "\033[1mUsage:\033[0m mode|light|dark|toggle|wallpaper"
|
|
||||||
exit 1
|
|
||||||
elif [ "$1" = "mode" ]; then
|
|
||||||
echo -e "$MODE"
|
|
||||||
exit 0
|
|
||||||
elif [ "$1" = "wallpaper" ]; then
|
|
||||||
if [ $# -eq 1 ]; then
|
|
||||||
PICKED=$(zenity --file-selection --file-filter='Images | *.png *.jpg *.jpeg *.svg *.bmp *.gif')
|
|
||||||
cp "$PICKED" "$WALLPAPER"
|
|
||||||
else
|
|
||||||
cp "$2" "$WALLPAPER"
|
|
||||||
fi
|
|
||||||
elif [ "$1" = "toggle" ]; then
|
|
||||||
if [ "$MODE" = "light" ]; then
|
|
||||||
MODE="dark"
|
|
||||||
else
|
|
||||||
MODE="light"
|
|
||||||
fi
|
|
||||||
elif [ "$1" = "light" ] || [ "$1" = "dark" ]; then
|
|
||||||
MODE="$1"
|
|
||||||
elif [ "$1" = "init" ]; then
|
|
||||||
echo -e "\033[1mSetting up matugen\033[0m"
|
|
||||||
else
|
|
||||||
echo -e "\033[31mInvalid argument\033[0m"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f $WALLPAPER ]; then
|
|
||||||
echo -e "\033[31,1mNo wallpaper set\033[0m"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$MODE" = "light" ]; then
|
|
||||||
GTK_THEME="adw-gtk3"
|
|
||||||
else
|
|
||||||
GTK_THEME="adw-gtk3-dark"
|
|
||||||
fi
|
|
||||||
|
|
||||||
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/md3-evo.vim
|
|
||||||
|
|
||||||
dconf write /org/gnome/desktop/interface/gtk-theme "'$GTK_THEME'"
|
|
||||||
dconf write /org/gnome/desktop/interface/color-scheme "'prefer-$MODE'"
|
|
||||||
|
|
||||||
if command -v hyprctl &> /dev/null; then
|
|
||||||
hyprctl reload
|
|
||||||
fi
|
|
||||||
|
|
||||||
for i in $(pgrep -u "$USER" -x nvim); do
|
|
||||||
kill -USR1 "$i"
|
|
||||||
done
|
|
||||||
'';
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
home-manager.users.${username} = {
|
|
||||||
programs.kitty = {
|
|
||||||
extraConfig = ''
|
|
||||||
include ${homeCfg.xdg.configHome}/kitty/theme.conf
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.nixvim = {
|
|
||||||
opts.termguicolors = true;
|
|
||||||
colorscheme = "md3-evo";
|
|
||||||
autoCmd = [
|
|
||||||
{
|
|
||||||
event = [ "Signal" ];
|
|
||||||
pattern = [ "SIGUSR1" ];
|
|
||||||
command = "colorscheme md3-evo";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
gtk = {
|
|
||||||
gtk3.extraCss = "@import './theme.css';";
|
|
||||||
gtk4.extraCss = "@import './theme.css';";
|
|
||||||
};
|
|
||||||
|
|
||||||
wayland.windowManager.hyprland = {
|
|
||||||
settings.exec-once = [
|
|
||||||
"${pkgs.swww}/bin/swww-daemon"
|
|
||||||
"theme init"
|
|
||||||
];
|
|
||||||
extraConfig = ''
|
|
||||||
source=./theme.conf
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
xdg.configFile."matugen/config.toml" = {
|
|
||||||
/*
|
|
||||||
onChange = ''
|
|
||||||
theme init
|
|
||||||
'';
|
|
||||||
*/
|
|
||||||
source = (pkgs.formats.toml { }).generate "matugen" {
|
|
||||||
config = {
|
|
||||||
reload_apps = true;
|
|
||||||
reload_apps_list = {
|
|
||||||
kitty = homeCfg.programs.kitty.enable;
|
|
||||||
waybar = false;
|
|
||||||
dunst = homeCfg.services.dunst.enable;
|
|
||||||
};
|
|
||||||
|
|
||||||
set_wallpaper = true;
|
|
||||||
wallpaper_tool = "Swww";
|
|
||||||
|
|
||||||
custom_colors =
|
|
||||||
let
|
|
||||||
mkColor = category: color: {
|
|
||||||
color = cfg.${category}.${color};
|
|
||||||
blend = cfg.${category}.blend;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
red = mkColor "ansi" "red";
|
|
||||||
green = mkColor "ansi" "green";
|
|
||||||
yellow = mkColor "ansi" "yellow";
|
|
||||||
orange = mkColor "ansi" "orange";
|
|
||||||
blue = mkColor "ansi" "blue";
|
|
||||||
magenta = mkColor "ansi" "magenta";
|
|
||||||
cyan = mkColor "ansi" "cyan";
|
|
||||||
|
|
||||||
keywords = mkColor "syntax" "keywords";
|
|
||||||
functions = mkColor "syntax" "functions";
|
|
||||||
constants = mkColor "syntax" "constants";
|
|
||||||
properties = mkColor "syntax" "properties";
|
|
||||||
strings = mkColor "syntax" "strings";
|
|
||||||
numbers = mkColor "syntax" "numbers";
|
|
||||||
structures = mkColor "syntax" "structures";
|
|
||||||
types = mkColor "syntax" "types";
|
|
||||||
|
|
||||||
danger = mkColor "semantic" "danger";
|
|
||||||
warning = mkColor "semantic" "warning";
|
|
||||||
success = mkColor "semantic" "success";
|
|
||||||
info = mkColor "semantic" "info";
|
|
||||||
};
|
|
||||||
|
|
||||||
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 = {
|
|
||||||
kitty = {
|
|
||||||
input_path = ./kitty.conf;
|
|
||||||
output_path = "${homeCfg.xdg.configHome}/kitty/theme.conf";
|
|
||||||
};
|
|
||||||
nvim = {
|
|
||||||
input_path = ./nvim.vim;
|
|
||||||
output_path = "${homeCfg.xdg.configHome}/nvim/colors/md3-evo.vim";
|
|
||||||
};
|
|
||||||
hyprland = {
|
|
||||||
input_path = ./hyprland.conf;
|
|
||||||
output_path = "${homeCfg.xdg.configHome}/hypr/theme.conf";
|
|
||||||
};
|
|
||||||
anyrun = {
|
|
||||||
input_path = ./anyrun.css;
|
|
||||||
output_path = "${homeCfg.xdg.configHome}/anyrun/theme.css";
|
|
||||||
};
|
|
||||||
gtk3 = {
|
|
||||||
input_path = ./gtk.css;
|
|
||||||
output_path = "${homeCfg.xdg.configHome}/gtk-3.0/theme.css";
|
|
||||||
};
|
|
||||||
gtk4 = {
|
|
||||||
input_path = ./gtk.css;
|
|
||||||
output_path = "${homeCfg.xdg.configHome}/gtk-4.0/theme.css";
|
|
||||||
};
|
|
||||||
vesktop = {
|
|
||||||
input_path = ./discord.css;
|
|
||||||
output_path = "${homeCfg.xdg.configHome}/vesktop/themes/matugen.theme.css";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user