randomly choose a bg theme
This commit is contained in:
parent
0a3dabbbf2
commit
e50b2c45b0
3 changed files with 69 additions and 3 deletions
|
@ -99,5 +99,5 @@ desktop: {pkgs, ...}: {
|
|||
home.stateVersion = "22.05";
|
||||
manual.manpages.enable = false; # broken
|
||||
|
||||
_module.args.bg = "${pkgs.lotte-art}/2022-06-21-sammythetanuki-lotteplushpride.jxl";
|
||||
_module.args.withNSFW = false;
|
||||
}
|
||||
|
|
|
@ -121,5 +121,5 @@
|
|||
"https://cache.nixos.org/"
|
||||
];
|
||||
services.tailscale.useRoutingFeatures = "client";
|
||||
home-manager.users.darkkirb._module.args.bg = lib.mkForce "${pkgs.lotte-art}/2022-08-12-deathtoaster-funpit-scat.jxl";
|
||||
home-manager.users.darkkirb._module.args.withNSFW = lib.mkForce true;
|
||||
}
|
||||
|
|
|
@ -2,11 +2,77 @@
|
|||
pkgs,
|
||||
config,
|
||||
colorpickle,
|
||||
bg,
|
||||
withNSFW,
|
||||
lib,
|
||||
self,
|
||||
nixpkgs,
|
||||
...
|
||||
}: let
|
||||
theme = import ../../extra/theme.nix;
|
||||
inherit (config.lib.formats.rasi) mkLiteral;
|
||||
|
||||
prepBGs = [
|
||||
["${pkgs.lotte-art}/2021-01-27-ceeza-lottedonut.jxl" "-crop" "2048x1152+0+106"]
|
||||
["${pkgs.lotte-art}/2021-09-15-cloverhare-lotteplush.jxl" "-crop" "1774x997+0+173"]
|
||||
["${pkgs.lotte-art}/2022-11-15-wolfsifi-maff-me-leashed.jxl" "-crop" "1699x956+0+88"]
|
||||
];
|
||||
|
||||
prepBGsNSFW = [
|
||||
["${pkgs.lotte-art}/2021-11-27-theroguez-lottegassyvore1.jxl" "-crop" "1233x694+0+65"]
|
||||
["${pkgs.lotte-art}/2021-12-12-baltnwolf-christmas-diaper.jxl" "-crop" "2599x1462+0+294"]
|
||||
["${pkgs.lotte-art}/2021-12-12-baltnwolf-christmas-diaper-messy.jxl" "-crop" "2599x1462+0+294"]
|
||||
["${pkgs.lotte-art}/2022-04-20-cloverhare-mxbatty-maffsie-train-plush.jxl" "-crop" "3377x1900+0+211"]
|
||||
["${pkgs.lotte-art}/2022-04-20-cloverhare-mxbatty-me-train-maffsie-plush.jxl" "-crop" "3377x1900+0+211"]
|
||||
["${pkgs.lotte-art}/2022-12-27-rexyi-scatych.jxl" "-crop" "2000x1120+0+0"]
|
||||
["${pkgs.lotte-art}/2023-03-09-rexyi-voredisposal-ych.jxl" "-crop" "2000x1120+0+0"]
|
||||
["${pkgs.lotte-art}/2023-04-16-baltnwolf-lottediaperplushies.jxl" "-gravity" "center" "-background" "white" "-extent" "5333x3000"]
|
||||
["${pkgs.lotte-art}/2023-04-16-baltnwolf-lottediaperplushies-messy.jxl" "-gravity" "center" "-background" "white" "-extent" "5333x3000"]
|
||||
];
|
||||
|
||||
fixupImage = instructions: pkgs.stdenv.mkDerivation {
|
||||
name = "bg.jxl";
|
||||
src = pkgs.emptyDirectory;
|
||||
nativeBuildInputs = [pkgs.imagemagick];
|
||||
buildPhase = ''
|
||||
convert ${toString instructions} $out
|
||||
'';
|
||||
installPhase = "true";
|
||||
};
|
||||
|
||||
validBGs = ["${pkgs.lotte-art}/2020-07-24-urbankitsune-bna-ych.jxl" "${pkgs.lotte-art}/2022-05-02-anonfurryartist-giftart.jxl" "${pkgs.lotte-art}/2022-06-21-sammythetanuki-lotteplushpride.jxl"] ++ (map fixupImage prepBGs);
|
||||
validBGsNSFW = ["${pkgs.lotte-art}2021-10-29-butterskunk-lotte-scat-buffet.jxl" "${pkgs.lotte-art}/2022-08-12-deathtoaster-funpit-scat.jxl" "${pkgs.lotte-art}/2022-08-15-deathtoaster-funpit-mud.jxl"] ++ (map fixupImage prepBGsNSFW) ++ validBGs;
|
||||
|
||||
mod = a: b: a - (a / b * b);
|
||||
choose = l: rand: let len = builtins.length l; in builtins.elemAt l (mod rand len);
|
||||
hexToIntList = {
|
||||
"0" = 0;
|
||||
"1" = 1;
|
||||
"2" = 2;
|
||||
"3" = 3;
|
||||
"4" = 4;
|
||||
"5" = 5;
|
||||
"6" = 6;
|
||||
"7" = 7;
|
||||
"8" = 8;
|
||||
"9" = 9;
|
||||
"a" = 10;
|
||||
"b" = 11;
|
||||
"c" = 12;
|
||||
"d" = 13;
|
||||
"e" = 14;
|
||||
"f" = 15;
|
||||
"A" = 10;
|
||||
"B" = 11;
|
||||
"C" = 12;
|
||||
"D" = 13;
|
||||
"E" = 14;
|
||||
"F" = 15;
|
||||
};
|
||||
hexToInt = s: lib.foldl (state: new: state * 16 + hexToIntList.${new}) 0 (lib.strings.stringToCharacters s);
|
||||
|
||||
seed = hexToInt (self.shortRev or nixpkgs.shortRev);
|
||||
bg = choose (if withNSFW then validBGsNSFW else validBGs) seed;
|
||||
|
||||
color = n:
|
||||
config.environment.graphical.colors.main."${builtins.toString n}";
|
||||
color' = n: mkLiteral (color n);
|
||||
|
|
Loading…
Reference in a new issue