phosh: Handle background dimming at the package level

Should improve performance since we no longer depend on a background
gradient in CSS.
This commit is contained in:
Donovan Glover 2024-09-03 22:34:05 -04:00
parent dadee6bb08
commit fe3f38acdd
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
2 changed files with 17 additions and 13 deletions

View File

@ -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 {

View File

@ -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
'';