Modules/Color: Move wallpaper selection from hyprland module to color module

This commit is contained in:
2025-07-20 15:17:53 +02:00
parent 90f7dc8845
commit a67029abe7
18 changed files with 121 additions and 80 deletions
+3 -4
View File
@@ -54,11 +54,11 @@
color = {
scheme = "catppuccin-mocha";
font = builtins.head nixosConfig.fonts.fontconfig.defaultFonts.monospace;
wallpaper = "Windows";
bg = "base";
text = "text";
accent = "mauve";
accentHL = "pink";
accentHl = "pink";
accentDim = "lavender";
accentText = "base";
};
@@ -84,7 +84,6 @@
hyprland = {
enable = !headless;
dunst.enable = !config.modules.hyprpanel.enable; # Disable for hyprpanel
wallpaper = "City-Outlook";
keybindings = {
main-mod = "SUPER";
+14 -7
View File
@@ -63,17 +63,24 @@ in {
colorDefs =
scheme
// {
bg = scheme.${color.bg};
text = scheme.${color.text};
accent = scheme.${color.accent};
accentHL = scheme.${color.accentHL};
accentHl = scheme.${color.accentHl};
accentDim = scheme.${color.accentDim};
accentText = scheme.${color.accentText};
};
mkColorAssignment = key: {${key} = colorDefs.${key};};
mkStringColorAssignment = key: {${key} = "#${colorDefs.${key}}";};
mkRgbColorAssignment = key: {${key} = mylib.color.hexToRGB colorDefs.${key};};
mkRgbStringColorAssignment = key: {${key} = mylib.color.hexToRGBString "," colorDefs.${key};};
mkColorAssignment = key: {
${key} = colorDefs.${key};
};
mkStringColorAssignment = key: {
${key} = "#${colorDefs.${key}}";
};
mkRgbColorAssignment = key: {
${key} = mylib.color.hexToRGB colorDefs.${key};
};
mkRgbStringColorAssignment = key: {
${key} = mylib.color.hexToRGBString "," colorDefs.${key};
};
in {
# RRGGBB (0-F)
hex =
+64 -37
View File
@@ -32,7 +32,7 @@
"mantle"
"crust"
];
in {
in rec {
scheme = lib.mkOption {
type = lib.types.enum [
"catppuccin-latte"
@@ -50,6 +50,69 @@ in {
default = "JetBrainsMono Nerd Font Mono";
};
# This option is set automatically
wallpapers = let
# Collect all the available wallpapers.
# We can't do this in default.nix as the value
# needs to be available during option evaluation.
wallpapers = let
rmFileExt = file: builtins.replaceStrings [".jpg"] [""] file;
rmBasePath = file: let
matches = builtins.match "/.*/(.*)" file;
in
if matches == null
then file
else (builtins.head matches);
in
lib.filesystem.listFilesRecursive ../../../wallpapers
|> builtins.map builtins.toString
|> builtins.map rmFileExt
|> builtins.map rmBasePath;
in
lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "The available wallpapers";
default = wallpapers;
};
wallpaper = lib.mkOption {
type = lib.types.enum wallpapers.default;
description = "The wallpaper to use";
example = "Foggy-Lake";
default = "Foggy-Lake";
};
# Some semantic aliases for colors
accent = lib.mkOption {
type = lib.types.enum colorKeys;
description = "The accent color to use";
example = "mauve";
default = "mauve";
};
accentHl = lib.mkOption {
type = lib.types.enum colorKeys;
description = "The accented accent color to use";
example = "pink";
default = "pink";
};
accentDim = lib.mkOption {
type = lib.types.enum colorKeys;
description = "The dim accent color to use";
example = "lavender";
default = "lavender";
};
accentText = lib.mkOption {
type = lib.types.enum colorKeys;
description = "The text color to use for accents";
example = "base";
default = "base";
};
# These options will be populated automatically.
hex = lib.mkOption {
@@ -71,40 +134,4 @@ in {
type = lib.types.attrs;
description = "Colors in \"RR,GG,BB\" decimal format";
};
# Some semantic aliases for colors
bg = lib.mkOption {
type = lib.types.enum colorKeys;
description = "The color to use as background";
example = "base";
default = "base";
};
text = lib.mkOption {
type = lib.types.enum colorKeys;
description = "The text color to use";
example = "text";
default = "text";
};
accent = lib.mkOption {
type = lib.types.enum colorKeys;
description = "The accent color to use";
example = "mauve";
default = "mauve";
};
accentHL = lib.mkOption {
type = lib.types.enum colorKeys;
description = "The accented accent color to use";
example = "pink";
default = "pink";
};
accentText = lib.mkOption {
type = lib.types.enum colorKeys;
description = "The text color to use for accents";
example = "base";
default = "base";
};
}
+3 -3
View File
@@ -235,7 +235,7 @@ in {
background = [
{
path = "${config.paths.nixflake}/wallpapers/${hyprland.wallpaper}.jpg";
path = "${config.paths.nixflake}/wallpapers/${color.wallpaper}.jpg";
blur_passes = 3;
blur_size = 10;
monitor = "";
@@ -305,12 +305,12 @@ in {
preload = let
mkPreload = name: "${config.paths.nixflake}/wallpapers/${name}.jpg";
in
hyprland.wallpapers |> builtins.map mkPreload;
color.wallpapers |> builtins.map mkPreload;
wallpaper = let
mkWallpaper = monitor:
"${monitor}, "
+ "${config.paths.nixflake}/wallpapers/${hyprland.wallpaper}.jpg";
+ "${config.paths.nixflake}/wallpapers/${color.wallpaper}.jpg";
in
hyprland.monitors
|> builtins.attrNames
-25
View File
@@ -17,31 +17,6 @@
description = "Keyboard layout variant";
};
# A bit dumb, but I want a single location where those are defined.
# Only supposed to be set from here.
wallpapers = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "Available wallpapers";
# Run eza -1 | sd ".jpg" "" | sd "^" "\"" | sd "\$" "\"" | sd "\"\"" "" | wl-copy
# in ~/NixFlake/wallpapers/
default = [
"Blade-Runner-Downwards"
"Blade-Runner-Upwards"
"City-Outlook"
"Everest-Fishing"
"Foggy-Lake"
"Three-Bears"
];
};
wallpaper = lib.mkOption {
type = lib.types.enum wallpapers.default;
example = "Three-Bears";
description = "Wallpaper to use";
default = "Foggy-Lake";
};
dunst.enable = lib.mkEnableOption "Enable dunst notification daemon";
monitors = lib.mkOption {
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.