{{- if (ne .host.distro.family "darwin") -}}
#!/usr/bin/env bash
# @file macOS Set Wallpaper
# @brief Ensures the macOS wallpaper is set to the Betelgeuse wallpaper for macOS.
# @description
#     This script ensures the macOS desktop wallpaper is set to the macOS Betelgeuse wallpaper. It uses the
#     `m` CLI to apply the change.

{{ includeTemplate "universal/profile" }}
{{ includeTemplate "universal/logg" }}

# Betelgeuse-macOS wallpaper hash: {{ include (joinPath .chezmoi.homeDir ".local" "src" "betelgeuse" "share" "wallpapers" "Betelgeuse-macOS" "contents" "source.png") | sha256sum }}

### Set macOS wallpaper
if command -v m > /dev/null && [ -f "${XDG_DATA_HOME:-$HOME/.local/share}/betelgeuse/share/wallpapers/Betelgeuse-macOS/contents/source.png" ]; then
  logg info 'Setting macOS wallpaper with m'
  m wallpaper "${XDG_DATA_HOME:-$HOME/.local/share}/betelgeuse/share/wallpapers/Betelgeuse-macOS/contents/source.png"
else
  logg warn 'Either m or the macOS default wallpaper is missing.'
fi
{{ end -}}
