Wallpaper: Add support for predefined styles.

This commit is contained in:
Dmitry Voronin 2024-12-28 11:22:38 +03:00
parent b783cf0d86
commit 3565544f46
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
2 changed files with 49 additions and 36 deletions

View file

@ -1,9 +1,13 @@
# Download the wallpaper here. # Download the wallpaper here.
{ pkgs, lib, ... }: { pkgs, lib, ... }:
let let
url = "https://i.imgur.com/03KK4WG.jpeg"; url = "https://i.imgur.com/AKsJ3Rl.jpeg";
sha256 = "sha256-lCaYGl+Y1iLtslDqAu/HTqpyWgSOnR+bMI0fKSwjW6w="; sha256 = "sha256-DIgboGiIGJb2bKi7zqb17m7jctEgWyrSI/mSypeV7dQ=";
forceContrastText = false; forceContrastText = false;
# SEE: https://github.com/tinted-theming/schemes
# Warm: "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml"
style = null;
in in
{ {
options.module.wallpaper = { options.module.wallpaper = {
@ -15,5 +19,9 @@ in
default = pkgs.fetchurl { inherit url sha256; }; default = pkgs.fetchurl { inherit url sha256; };
type = lib.types.path; type = lib.types.path;
}; };
style = lib.mkOption {
default = style;
type = with lib.types; nullOr (oneOf [ path lines attrs ]);
};
}; };
} }

View file

@ -1,9 +1,11 @@
{ config, ... }: { config, lib, ... }:
let let
style = config.module.style; style = config.module.style;
wallpaper = config.module.wallpaper; wallpaper = config.module.wallpaper;
in in
{ {
config = lib.mkMerge [
{
stylix = { stylix = {
inherit (config.module.style) cursor; inherit (config.module.style) cursor;
enable = true; enable = true;
@ -28,14 +30,17 @@ in
applications = application; applications = application;
popups = popups; popups = popups;
}; };
override =
if wallpaper.forceContrastText then
{
base04 = "000000";
base05 = "ffffff";
base06 = "ffffff";
}
else
{ };
}; };
}
(lib.mkIf wallpaper.forceContrastText {
stylix.override = {
base04 = lib.mkForce "000000";
base05 = lib.mkForce "ffffff";
base06 = lib.mkForce "ffffff";
};
})
(lib.mkIf (wallpaper.style != null) { stylix.base16Scheme = wallpaper.style; })
];
} }