Name: sl-daily-background-unsplash Version: 1.1.0 Release: 2%{?dist} Summary: Sl's daily background image fetcher for Unsplash License: MIT URL: https://slsrepo.com BuildArch: noarch Requires: bash Requires: curl Requires: coreutils Requires: awww Recommends: glib2 Recommends: plasma-workspace Provides: sl-daily-background = %{version}-%{release} Conflicts: sl-daily-background %description Sl's daily background image fetcher for Unsplash. %prep # No external source. Files are generated from the spec, matching the Arch PKGBUILD. %build cat > sl-daily-background <<'EOF' #!/usr/bin/env bash set -euo pipefail CACHE_DIR="/usr/local/share/backgrounds/unsplash-backgrounds" mkdir -p "$CACHE_DIR" date="$(date +%%Y%%m%%d)" img="$CACHE_DIR/${date}.jpg" if [[ ! -f "$img" ]]; then curl -L -fsSL "https://picsum.photos/3840/2160" -o "$img.part" mv -f "$img.part" "$img" fi # Ensure the local bin directory exists before symlinking mkdir -p ~/.local/bin ln -sf -- "$img" ~/.local/bin/current-background ln -sf -- "$img" /usr/local/share/backgrounds/sl-greeter-current-background # --- awww --- if command -v awww >/dev/null 2>&1; then if ! pgrep -x awww-daemon >/dev/null 2>&1; then awww-daemon --no-cache & for _ in {1..20}; do sleep 0.1; awww query >/dev/null 2>&1 && break; done fi awww img "$img" --transition-type fade --transition-duration 1 || true elif command -v swww >/dev/null 2>&1; then if ! pgrep -x swww-daemon >/dev/null 2>&1; then swww-daemon --no-cache & for _ in {1..20}; do sleep 0.1; swww query >/dev/null 2>&1 && break; done fi swww img "$img" --transition-type fade --transition-duration 1 || true fi # --- DankMaterialShell and sl-lock IPC --- if pgrep -x dms >/dev/null 2>&1 || pgrep -f dms-shell >/dev/null 2>&1; then dms ipc call wallpaper set "$img" fi if command -v notify-send >/dev/null 2>&1; then notify-send "Background updated :)" "Unsplash Daily — ${date}" -i "$img" -t 2500 || true fi if command -v qs >/dev/null 2>&1 && pgrep -f "qs.*sl-lock" >/dev/null 2>&1; then qs -c sl-lock ipc call background-image refresh >/dev/null 2>&1 || true fi # --- GNOME --- if command -v gsettings >/dev/null 2>&1; then gsettings set org.gnome.desktop.background picture-uri "file://$img" >/dev/null 2>&1 || true gsettings set org.gnome.desktop.background picture-uri-dark "file://$img" >/dev/null 2>&1 || true gsettings set org.gnome.desktop.screensaver picture-uri "file://$img" >/dev/null 2>&1 || true fi # --- KDE Plasma --- if command -v plasma-apply-wallpaperimage >/dev/null 2>&1; then plasma-apply-wallpaperimage "$img" >/dev/null 2>&1 || true fi if command -v kwriteconfig6 >/dev/null 2>&1; then kwriteconfig6 --file kscreenlockerrc --group Greeter --group Wallpaper --group org.kde.image --group General --key Image "file://$img" >/dev/null 2>&1 || true elif command -v kwriteconfig5 >/dev/null 2>&1; then kwriteconfig5 --file kscreenlockerrc --group Greeter --group Wallpaper --group org.kde.image --group General --key Image "file://$img" >/dev/null 2>&1 || true fi EOF cat > sl-daily-background.service <<'EOF' [Unit] Description=Sl's service to fetch and set today's background image with awww using the service you chose [Service] Type=oneshot ExecStart=/usr/bin/sl-daily-background EOF cat > sl-daily-background.timer <<'EOF' [Unit] Description=Sl's daily background image fetcher timer [Timer] OnCalendar=10:00 #RandomizedDelaySec=15min Persistent=true Unit=sl-daily-background.service [Install] WantedBy=timers.target EOF %install install -Dm755 sl-daily-background %{buildroot}%{_bindir}/sl-daily-background install -Dm644 sl-daily-background.service %{buildroot}%{_prefix}/lib/systemd/user/sl-daily-background.service install -Dm644 sl-daily-background.timer %{buildroot}%{_prefix}/lib/systemd/user/sl-daily-background.timer %post -p /bin/bash # Ensure the global backgrounds directory exists mkdir -p /usr/local/share/backgrounds # Grab the user who ran sudo pacman, fallback to the first normal user REAL_USER=${SUDO_USER:-$(awk -v val=1000 -F ":" '$3 >= val {print $1; exit}' /etc/passwd)} if [ -n "$REAL_USER" ] && [ "$REAL_USER" != "root" ]; then chown -R "$REAL_USER:$REAL_USER" /usr/local/share/backgrounds fi echo "=================================================================" echo " sl-daily-background installed successfully! " echo " " echo " To activate the daily background fetcher, run the following " echo " as your normal user (WITHOUT sudo): " echo " " # Init system detection for instructions if [ -d /run/systemd/system ]; then echo " systemctl --user enable --now sl-daily-background.timer " else echo " Run 'crontab -e' and paste the following line to add it to your cron jobs: " echo " 0 10 * * * /usr/bin/sl-daily-background " fi echo "=================================================================" %files %{_bindir}/sl-daily-background %{_prefix}/lib/systemd/user/sl-daily-background.service %{_prefix}/lib/systemd/user/sl-daily-background.timer %changelog * Sat Jun 20 2026 Sl (Shahaf Levi) - 1.1.0-2 - Initial COPR package for Slash