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
cfg = config.modules.desktop.swww;
img = ../../assets/wallpaper.png;
wallpapersFolder = "${pkgs.my.wallpapers}/share/backgrounds";
lastWallpaper = "$XDG_DATA_HOME/swww-last-wallpaper";
in {
options.modules.desktop.swww = {
enable = mkEnableOption "Enable swww, a Solution to your Wayland Wallpaper Woes";
@ -16,8 +17,25 @@ in {
startScript = mkOption {
type = types.package;
default = pkgs.writeScript "swww-start" ''
if [ ! -f "${lastWallpaper}" ]; then
echo "$(ls ${wallpapersFolder} | shuf -n 1)" > "${lastWallpaper}"
fi
${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"
"custom/weather"
"privacy"
"custom/wallpaper"
];
};
"group/power" = {
@ -98,6 +99,12 @@ in {
tooltip-format = "Power menu";
on-click = "${powerSelect}";
};
"custom/wallpaper" = {
format = "";
tooltip = true;
tooltip-format = "Change wallpaper";
on-click = "${config.modules.desktop.swww.swapScript}";
};
"hyprland/workspaces" = {
format = "{icon}";
format-icons = {