From e572387f9928b6f3f0abffcfe3f5cfb9aef69ac8 Mon Sep 17 00:00:00 2001 From: reidlab Date: Tue, 21 Apr 2026 00:59:16 -0700 Subject: [PATCH] drop redundant things in awww --- modules/desktop/awww.nix | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/modules/desktop/awww.nix b/modules/desktop/awww.nix index 941d25c..54fd2bf 100644 --- a/modules/desktop/awww.nix +++ b/modules/desktop/awww.nix @@ -3,12 +3,6 @@ with lib; let cfg = config.modules.desktop.awww; - - # TODO: this whole thing is a little silly, but i cant find a better way to ref it in the scripts - # maybe we can reference the config in the scripts? in a let of course :) - wallpapersFolder = "${pkgs.my.wallpapers}/share/backgrounds"; - lastWallpaper = "$XDG_DATA_HOME/awww-last-wallpaper"; - lastWallpaperSym = "$XDG_DATA_HOME/awww-last-wallpaper-sym"; in { options.modules.desktop.awww = { enable = mkEnableOption "Enable awww, an Answer to your Wayland Wallpaper Woes"; @@ -19,17 +13,17 @@ in { }; wallpapersFolder = mkOption { type = types.str; - default = wallpapersFolder; + default = "${pkgs.my.wallpapers}/share/backgrounds"; example = "$XDG_PICTURES_DIR/wallpapers"; }; lastWallpaper = mkOption { type = types.str; - default = lastWallpaper; + default = "$XDG_DATA_HOME/awww-last-wallpaper"; example = "$XDG_DATA_HOME/awww-last-wallpaper"; }; lastWallpaperSym = mkOption { type = types.str; - default = lastWallpaperSym; + default = "$XDG_DATA_HOME/awww-last-wallpaper-sym"; example = "$XDG_DATA_HOME/awww-last-wallpaper-sym"; }; setScript = mkOption { @@ -37,12 +31,12 @@ in { default = pkgs.writeShellScript "awww-set" '' set -euo pipefail - if [ ! -f "${lastWallpaper}" ]; then - echo "$(ls ${wallpapersFolder} | shuf -n 1)" > "${lastWallpaper}" + if [ ! -f "${cfg.lastWallpaper}" ]; then + echo "$(ls ${cfg.wallpapersFolder} | shuf -n 1)" > "${cfg.lastWallpaper}" fi - ln -sf "${wallpapersFolder}/$(cat ${lastWallpaper})" "${lastWallpaperSym}" # in case the hash of the pkg changes - ${lib.getExe cfg.package} img "${wallpapersFolder}/$(cat ${lastWallpaper})" --transition-type none + ln -sf "${cfg.wallpapersFolder}/$(cat ${cfg.lastWallpaper})" "${cfg.lastWallpaperSym}" # in case the hash of the pkg changes + ${lib.getExe cfg.package} img "${cfg.wallpapersFolder}/$(cat ${cfg.lastWallpaper})" --transition-type none ''; }; swapScript = mkOption { @@ -50,15 +44,15 @@ in { default = pkgs.writeShellScript "awww-swap" '' set -euo pipefail - file=$(ls ${wallpapersFolder} | ${lib.getExe config.modules.desktop.rofi.package} -dmenu -sep '\n' -i -p "select a wallpaper") - wallpaper="${wallpapersFolder}/$file" + file=$(ls ${cfg.wallpapersFolder} | ${lib.getExe config.modules.desktop.rofi.package} -dmenu -sep '\n' -i -p "select a wallpaper") + wallpaper="${cfg.wallpapersFolder}/$file" [ ! -f "$wallpaper" ] && exit 1 ${lib.getExe cfg.package} img "$wallpaper" --transition-type grow --transition-fps 60 --transition-pos 1.0,1.0 --transition-duration 1.5 - ln -sf "$wallpaper" "${lastWallpaperSym}" - echo "$file" > "${lastWallpaper}" + ln -sf "$wallpaper" "${cfg.lastWallpaperSym}" + echo "$file" > "${cfg.lastWallpaper}" ''; }; };