From fe3f38acddd7c9cbfca4fd7a0dbda5fb16ef045f Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Tue, 3 Sep 2024 22:34:05 -0400 Subject: [PATCH] phosh: Handle background dimming at the package level Should improve performance since we no longer depend on a background gradient in CSS. --- hosts/phone/configuration.nix | 19 +++++++------------ packages/phosh-backgrounds.nix | 11 ++++++++++- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/hosts/phone/configuration.nix b/hosts/phone/configuration.nix index ef1520b9..3d4232b9 100644 --- a/hosts/phone/configuration.nix +++ b/hosts/phone/configuration.nix @@ -11,15 +11,10 @@ let inherit (lib.gvariant) mkTuple mkUint32; inherit (config.modules.system) username; inherit (builtins) attrValues; - inherit (self.packages.${pkgs.system}) phosh-backgrounds; - getColorCh = colorName: channel: config.lib.stylix.colors."${colorName}-rgb-${channel}"; - - rgba = - color: transparency: - ''rgba(${getColorCh color "r"}, ${getColorCh color "g"}, ${getColorCh color "b"}, ${transparency})''; - - bg = ''linear-gradient(${rgba "base00" "0.7"}, ${rgba "base00" "0.7"})''; + phosh-backgrounds = self.packages.${pkgs.system}.phosh-backgrounds.override { + color = config.lib.stylix.colors.base00; + }; no = { name = ""; @@ -178,19 +173,19 @@ in stylix.targets.gtk.extraCss = # css '' phosh-lockscreen { - background: ${bg}, url('${phosh-backgrounds}/wall-lock.jpg'); + background: url('${phosh-backgrounds}/wall-lock.jpg'); } phosh-app-grid { - background: ${bg}, url('${phosh-backgrounds}/wall-grid.jpg'); + background: url('${phosh-backgrounds}/wall-grid.jpg'); } phosh-top-panel { - background: ${bg}, url('${phosh-backgrounds}/wall-panel.jpg'); + background: url('${phosh-backgrounds}/wall-panel.jpg'); } phosh-home { - background: ${bg}, url('${phosh-backgrounds}/wall-home.jpg'); + background: url('${phosh-backgrounds}/wall-home.jpg'); } phosh-lockscreen, phosh-app-grid, phosh-top-panel, phosh-home { diff --git a/packages/phosh-backgrounds.nix b/packages/phosh-backgrounds.nix index aa2b0260..dc129141 100644 --- a/packages/phosh-backgrounds.nix +++ b/packages/phosh-backgrounds.nix @@ -2,6 +2,9 @@ lib, stdenvNoCC, fetchurl, + fd, + imagemagick, + color ? "181818", }: stdenvNoCC.mkDerivation { @@ -34,6 +37,11 @@ stdenvNoCC.mkDerivation { }) ]; + nativeBuildInputs = [ + fd + imagemagick + ]; + unpackPhase = '' runHook preUnpack @@ -47,7 +55,8 @@ stdenvNoCC.mkDerivation { installPhase = '' runHook preInstall - install -Dm644 *.jpg -t $out + mkdir -p $out + fd -e jpg -x magick "{}" -fill "#${color}" -colorize 30% "$out/{.}.jpg" runHook postInstall '';