treewide: blur regreet wallpaper
This commit is contained in:
parent
1561a2075e
commit
5cfbe69893
2 changed files with 15 additions and 49 deletions
|
@ -1,4 +1,4 @@
|
|||
{lib, ...}: let
|
||||
let
|
||||
# convert rrggbb hex to rgba(r, g, b, a)
|
||||
rgba = c: let
|
||||
r = toString (hexToDec (builtins.substring 0 2 c));
|
||||
|
@ -7,7 +7,7 @@
|
|||
in "rgba(${r}, ${g}, ${b}, .5)";
|
||||
|
||||
# Helper function to convert hex color to decimal RGB values
|
||||
hexToDec = v: let
|
||||
hexToDec = lib: v: let
|
||||
hexToInt = {
|
||||
"0" = 0;
|
||||
"1" = 1;
|
||||
|
@ -38,52 +38,15 @@
|
|||
(lib.imap (k: v: hexToInt."${v}" * (pow 16 (builtins.length chars - k - 1))) chars);
|
||||
|
||||
# Power function for exponentiation
|
||||
pow = base: exponent: lib.foldl' (acc: _: acc * base) 1 (lib.range 1 exponent);
|
||||
pow = lib: base: exponent: lib.foldl' (acc: _: acc * base) 1 (lib.range 1 exponent);
|
||||
|
||||
# Converts hex color to KDE color format
|
||||
colorToKde = name: hexColor: let
|
||||
r = hexToDec (builtins.substring 0 2 hexColor);
|
||||
g = hexToDec (builtins.substring 2 2 hexColor);
|
||||
b = hexToDec (builtins.substring 4 2 hexColor);
|
||||
in "[${name}]\nColor=${toString r},${toString g},${toString b}\n";
|
||||
|
||||
# Mapping base16 colors to KDE color scheme sections
|
||||
schemeToKonsole = scheme: let
|
||||
inherit (scheme) palette;
|
||||
|
||||
colorMap = {
|
||||
base00 = ["Background" "BackgroundFaint" "BackgroundIntense"];
|
||||
base01 = ["Color0"];
|
||||
base02 = ["Color0Intense"];
|
||||
base04 = ["Color4"];
|
||||
base05 = ["Foreground" "ForegroundFaint" "ForegroundIntense"];
|
||||
base06 = ["Color7"];
|
||||
base07 = ["Color7Intense"];
|
||||
base08 = ["Color1" "Color1Intense"];
|
||||
base09 = ["Color1Intense"];
|
||||
base0A = ["Color3" "Color3Intense"];
|
||||
base0B = ["Color2" "Color2Intense"];
|
||||
base0C = ["Color6" "Color6Intense"];
|
||||
base0D = ["Color4" "Color4Intense"];
|
||||
base0E = ["Color5" "Color5Intense"];
|
||||
};
|
||||
|
||||
colorSections = lib.concatStringsSep "\n" (lib.attrsets.mapAttrsToList
|
||||
(name: value:
|
||||
lib.concatMapStrings (slot: colorToKde slot value) (colorMap.${name} or []))
|
||||
palette);
|
||||
in
|
||||
lib.concatStringsSep "\n" [
|
||||
"[General]"
|
||||
"Description=${scheme.name}"
|
||||
"Opacity=1"
|
||||
"Wallpaper="
|
||||
colorSections
|
||||
];
|
||||
|
||||
# Create a KDE konsole color scheme from base16 colors
|
||||
mkKonsoleColorScheme = pkgs: scheme:
|
||||
pkgs.writeText "${scheme.name}.colorscheme" (schemeToKonsole scheme);
|
||||
blurImage = pkgs: path:
|
||||
pkgs.runCommand "${builtins.baseNameOf path}-blurred" {
|
||||
buildInputs = [pkgs.imagemagick];
|
||||
}
|
||||
''
|
||||
magick ${path} -gaussian-blur 0x12 "$out"
|
||||
'';
|
||||
in {
|
||||
inherit mkKonsoleColorScheme rgba;
|
||||
inherit blurImage rgba;
|
||||
}
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
inputs,
|
||||
config,
|
||||
lib,
|
||||
lib',
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) getExe evalModules;
|
||||
inherit (lib') blurImage;
|
||||
inherit (inputs) niri;
|
||||
in {
|
||||
services.greetd = let
|
||||
|
@ -72,7 +74,8 @@ in {
|
|||
};
|
||||
settings = {
|
||||
background = {
|
||||
path = config.theme.wallpaper;
|
||||
path = blurImage pkgs config.theme.wallpaper;
|
||||
|
||||
fit = "Fill";
|
||||
};
|
||||
GTK = {
|
||||
|
|
Loading…
Reference in a new issue