update cross-module package references, nuke execOnStart

This commit is contained in:
Reid 2024-12-14 16:40:14 -08:00
parent 6d61976106
commit ff647de9ce
Signed by: reidlab
GPG key ID: DAF5EAF6665839FD
13 changed files with 135 additions and 73 deletions

View file

@ -14,21 +14,20 @@ in {
default = pkgs.swww;
example = "pkgs.swww";
};
startScript = mkOption {
setScript = mkOption {
type = types.package;
default = pkgs.writeScript "swww-start" ''
default = pkgs.writeShellScript "swww-set" ''
if [ ! -f "${lastWallpaper}" ]; then
echo "$(ls ${wallpapersFolder} | shuf -n 1)" > "${lastWallpaper}"
fi
${cfg.package}/bin/swww-daemon &
${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")
default = pkgs.writeShellScript "swww-swap" ''
file=$(ls ${wallpapersFolder} | ${lib.getExe config.modules.desktop.rofi.package} -dmenu -sep '\n' -i -p "select a wallpaper")
wallpaper="${wallpapersFolder}/$file"
[ ! -f "$wallpaper" ] && exit 1
@ -42,6 +41,24 @@ in {
config = mkIf cfg.enable {
hm.home.packages = [ cfg.package ];
modules.desktop.execOnStart = [ "${cfg.startScript}" ];
hm.systemd.user.services.swww = {
Unit = {
Description = "swww, a Solution to your Wayland Wallpaper Woes";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
Type = "simple";
ExecStart = "${cfg.package}/bin/swww-daemon";
ExecStartPost = "${cfg.setScript}";
Restart = "on-failure";
RestartSec = 5;
};
};
};
}