stylix: Dynamically generate wallpaper from color scheme

Fixes an issue where previously the background color would be incorrect
when the color scheme was changed, which was particularly noticeable on
Phosh where the background would display when toggling the on-screen
keyboard.

Note that the logo has been intentionally left out this time to simplify
things a bit.
This commit is contained in:
Donovan Glover 2024-07-18 11:02:07 -04:00
parent 40c7b04a9a
commit b4d3190167
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
2 changed files with 19 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

View File

@ -4,11 +4,28 @@ let
inherit (lib) mkEnableOption mkIf mkMerge mkOption;
inherit (lib.types) float int;
inherit (config.modules.system) username;
inherit (config.lib.stylix.colors) base00;
inherit (cfg) bloat gnome plasma container opacity fontSize graphical;
inherit (nix-config.packages.${pkgs.system}) aleo-fonts;
inherit (pkgs) phinger-cursors noto-fonts-cjk-sans maple-mono noto-fonts-emoji;
inherit (pkgs) phinger-cursors noto-fonts-cjk-sans maple-mono noto-fonts-emoji stdenvNoCC imagemagick;
inherit (builtins) attrValues;
stylix-background = stdenvNoCC.mkDerivation {
pname = "stylix-background";
version = base00;
dontUnpack = true;
nativeBuildInputs = [
imagemagick
];
postInstall = ''
mkdir -p $out
magick -size 1x1 xc:#${base00} $out/wallpaper.png
'';
};
cfg = config.modules.desktop;
in
{
@ -170,7 +187,7 @@ in
stylix = {
enable = true;
image = ../assets/wallpaper.png;
image = "${stylix-background}/wallpaper.png";
polarity = "dark";
base16Scheme = ../assets/selenized-black.yaml;