1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 18:21:07 +01:00
Files
niveum/configs/wallpaper.nix
2025-07-08 20:56:40 +02:00

34 lines
904 B
Nix

{
pkgs,
lib,
...
}: let
# url = "http://wallpaper.r/realwallpaper-krebs-stars-berlin.png";
url = "http://wallpaper.r/realwallpaper-krebs.png";
stateDir = "~/.cache/wallpaper";
in {
systemd.user.services.wallpaper = {
wantedBy = ["graphical-session.target"];
after = ["network.target"];
script = ''
set -euf
mkdir -p ${stateDir}
chmod o+rx ${stateDir}
cd ${stateDir}
(${pkgs.curl}/bin/curl -s -o wallpaper.tmp -z wallpaper.tmp ${lib.escapeShellArg url} && cp wallpaper.tmp wallpaper) || :
if [ -z $SWAYSOCK ]; then
${pkgs.feh}/bin/feh --no-fehbg --bg-scale wallpaper
else
${pkgs.sway}/bin/swaymsg -s $SWAYSOCK 'output * bg ${stateDir}/wallpaper fill'
fi
'';
startAt = "*:00,10,20,30,40,50";
serviceConfig = {
Restart = "always";
RestartSec = "15s";
StartLimitBurst = 0;
};
};
}