helpers/wallfx.py finds the subject with BiRefNet (onnxruntime, CPU), bakes outline maps per wallpaper and caches them; scans warm the cache in the background. The transition shader gains an outline mode: the line is drawn, the subject fills in, then the rest grows out of it. Uncached or subject-less wallpapers keep the colonies. wallpaper.outlineExclude opts wallpapers out. The Nix package provides the interpreter and the model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
1.4 KiB
Nix
34 lines
1.4 KiB
Nix
{ lib, stdenvNoCC, makeWrapper, quickshell, qt6, nodejs, python3, fetchurl, source }:
|
|
let
|
|
# Outline wallpaper transitions (quickshell/helpers/wallfx.py): BiRefNet lite
|
|
# finds a wallpaper's subject, run on the CPU through onnxruntime.
|
|
wallfxPython = python3.withPackages (ps: [ ps.numpy ps.opencv4 ps.pillow ps.onnxruntime ]);
|
|
wallfxModel = fetchurl {
|
|
url = "https://github.com/danielgatis/rembg/releases/download/v0.0.0/BiRefNet-general-bb_swin_v1_tiny-epoch_232.onnx";
|
|
sha256 = "0crky386fm0268hy5qglpqv1d5p5n6pv0phahxbsawpmfr1h402n";
|
|
};
|
|
in
|
|
stdenvNoCC.mkDerivation {
|
|
pname = "glassMxrph";
|
|
version = "0.2.0";
|
|
src = source;
|
|
nativeBuildInputs = [ makeWrapper nodejs ];
|
|
dontBuild = true;
|
|
doCheck = true;
|
|
checkPhase = "node tests/config.test.cjs";
|
|
installPhase = ''
|
|
mkdir -p $out/share/glassMxrph $out/bin
|
|
cp -r quickshell scripts tests docs dependencies.json README.md $out/share/glassMxrph/
|
|
makeWrapper $out/share/glassMxrph/scripts/glassmxrph $out/bin/glassmxrph \
|
|
--prefix PATH : ${lib.makeBinPath [ quickshell ]} \
|
|
--prefix QT_PLUGIN_PATH : ${qt6.qtimageformats}/${qt6.qtbase.qtPluginPrefix} \
|
|
--set-default GLASSMXRPH_WALLFX_PYTHON ${wallfxPython}/bin/python3 \
|
|
--set-default GLASSMXRPH_WALLFX_MODEL ${wallfxModel}
|
|
'';
|
|
meta = {
|
|
description = "Modular glass desktop shell for Quickshell and Hyprland";
|
|
platforms = lib.platforms.linux;
|
|
mainProgram = "glassmxrph";
|
|
};
|
|
}
|