worst wallpaper switcher EVER

This commit is contained in:
Reid 2024-11-14 14:27:25 -08:00
parent cff640a554
commit d6ba358108
Signed by: reidlab
GPG key ID: DAF5EAF6665839FD
13 changed files with 50 additions and 3 deletions

View file

@ -4,7 +4,8 @@ with lib;
let let
cfg = config.modules.desktop.swww; cfg = config.modules.desktop.swww;
img = ../../assets/wallpaper.png; wallpapersFolder = "${pkgs.my.wallpapers}/share/backgrounds";
lastWallpaper = "$XDG_DATA_HOME/swww-last-wallpaper";
in { in {
options.modules.desktop.swww = { options.modules.desktop.swww = {
enable = mkEnableOption "Enable swww, a Solution to your Wayland Wallpaper Woes"; enable = mkEnableOption "Enable swww, a Solution to your Wayland Wallpaper Woes";
@ -16,8 +17,25 @@ in {
startScript = mkOption { startScript = mkOption {
type = types.package; type = types.package;
default = pkgs.writeScript "swww-start" '' default = pkgs.writeScript "swww-start" ''
if [ ! -f "${lastWallpaper}" ]; then
echo "$(ls ${wallpapersFolder} | shuf -n 1)" > "${lastWallpaper}"
fi
${cfg.package}/bin/swww-daemon & ${cfg.package}/bin/swww-daemon &
${lib.getExe cfg.package} img "${img}" --transition-type none ${lib.getExe cfg.package} img "${wallpapersFolder}/$(cat ${lastWallpaper})" --transition-type none
'';
};
swapScript = mkOption {
type = types.package;
default = pkgs.writeScript "swww-swap" ''
file=$(ls ${wallpapersFolder} | ${lib.getExe pkgs.rofi-wayland} -dmenu -sep '\n' -i -p "select a wallpaper")
wallpaper="${wallpapersFolder}/$file"
[ ! -f "$wallpaper" ] && exit 1
${lib.getExe cfg.package} img "$wallpaper" --transition-type grow --transition-fps 60 --transition-pos 0.915,0.977 --transition-duration 1.5
echo "$file" > "${lastWallpaper}"
''; '';
}; };
}; };

View file

@ -66,6 +66,7 @@ in {
"battery" "battery"
"custom/weather" "custom/weather"
"privacy" "privacy"
"custom/wallpaper"
]; ];
}; };
"group/power" = { "group/power" = {
@ -98,6 +99,12 @@ in {
tooltip-format = "Power menu"; tooltip-format = "Power menu";
on-click = "${powerSelect}"; on-click = "${powerSelect}";
}; };
"custom/wallpaper" = {
format = "";
tooltip = true;
tooltip-format = "Change wallpaper";
on-click = "${config.modules.desktop.swww.swapScript}";
};
"hyprland/workspaces" = { "hyprland/workspaces" = {
format = "{icon}"; format = "{icon}";
format-icons = { format-icons = {

View file

@ -13,7 +13,7 @@ stdenvNoCC.mkDerivation {
installPhase = '' installPhase = ''
mkdir -p "$out/lib/firmware/brcm" mkdir -p "$out/lib/firmware/brcm"
cp -r lib/firmware/brcm/. "$out/lib/firmware/brcm/" cp -r "$src/lib/firmware/brcm/." "$out/lib/firmware/brcm/"
''; '';
meta = with lib; { meta = with lib; {

View file

@ -0,0 +1,22 @@
{ lib, stdenvNoCC }:
stdenvNoCC.mkDerivation {
pname = "wallpapers";
version = "unstable";
src = ./.;
# later, add XML files to /usr(?)/share/backgrounds
# then, it is selectable from places like in gnome and also do the same for KDE
installPhase = ''
mkdir -p "$out/share/backgrounds"
cp -r "$src/img/." "$out/share/backgrounds/"
'';
meta = with lib; {
description = "Small collection of wallpapers";
# idk what to put here:
# license = licenses.ofl;
platforms = platforms.all;
};
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

View file

Before

Width:  |  Height:  |  Size: 3.1 MiB

After

Width:  |  Height:  |  Size: 3.1 MiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 KiB