feat(install): set wallhaven 2133ly as default wallpaper

- lib/wallpaper.sh: downloads the default wallpaper at install time
  (tries .jpg then .png against the wallhaven CDN path) into
  ~/.config/hypr/wallpapers/default.<ext> and writes hyprpaper.conf
  pointing at it
- Override the source with WALLPAPER_URL=<direct-image-url> or just the
  URL stem with WALLPAPER_URL_BASE
- Existing hyprpaper.conf is backed up to .pre-install.<timestamp>
  unless it's already ours (marker comment)
- files/hypr/autostart.conf: exec-once = hyprpaper
- install.sh: wire setup_wallpaper into do_dotfiles_and_config

Tried to fetch from this sandbox to verify the extension but wallhaven
blocks datacenter IPs (403); the installer probes .jpg first then .png
when it actually runs on a residential network.
This commit is contained in:
Claude 2026-06-09 15:32:47 +00:00
parent 6577def1b5
commit 0e803e7366
No known key found for this signature in database
4 changed files with 108 additions and 1 deletions

View file

@ -88,6 +88,12 @@ top-right anchored, JetBrainsMono Nerd Font, per-urgency border colors
a rofi-driven menu with Lock / Suspend / Logout / Reboot / Shutdown.
Bound to **Super + Shift + E** in Hyprland and to the Waybar power button.
**Wallpaper:** downloads
[wallhaven.cc/w/2133ly](https://wallhaven.cc/w/2133ly) to
`~/.config/hypr/wallpapers/default.jpg` and writes `hyprpaper.conf` pointing
at it. Override with `WALLPAPER_URL=<direct-image-url>` before running the
installer (any pre-existing `hyprpaper.conf` is backed up first).
**Services enabled:** `sddm`, `NetworkManager`, `bluetooth`; user-level
`pipewire`, `pipewire-pulse`, `wireplumber`.

View file

@ -1,7 +1,8 @@
# Polkit agent for authentication dialogs.
exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
# Top bar + notifications + idle.
# Wallpaper, top bar, notifications, idle.
exec-once = hyprpaper
exec-once = waybar
exec-once = mako
exec-once = hypridle

View file

@ -20,6 +20,7 @@ source "$SCRIPT_DIR/lib/common.sh"
source "$SCRIPT_DIR/lib/packages.sh"
source "$SCRIPT_DIR/lib/dotfiles.sh"
source "$SCRIPT_DIR/lib/hyprland.sh"
source "$SCRIPT_DIR/lib/wallpaper.sh"
source "$SCRIPT_DIR/lib/services.sh"
usage() {
@ -55,6 +56,7 @@ do_packages() {
do_dotfiles_and_config() {
link_dotfiles
link_hyprland_config
setup_wallpaper
install_tpm
install_nvm
set_zsh_as_shell

98
install/lib/wallpaper.sh Normal file
View file

@ -0,0 +1,98 @@
#!/bin/bash
# Download the default wallpaper and write the hyprpaper config.
# Override the source URL with $WALLPAPER_URL (must be a direct image link).
# Default: https://wallhaven.cc/w/2133ly (direct CDN path)
DEFAULT_WALLPAPER_BASE="${WALLPAPER_URL_BASE:-https://w.wallhaven.cc/full/21/wallhaven-2133ly}"
WALLPAPER_DIR="$HOME/.config/hypr/wallpapers"
WALLPAPER_NAME="default"
download_wallpaper() {
mkdir -p "$WALLPAPER_DIR"
# If the user passed a fully-qualified URL, honor it directly.
if [[ -n ${WALLPAPER_URL:-} ]]; then
local ext="${WALLPAPER_URL##*.}"
[[ $ext =~ ^(jpg|jpeg|png|webp)$ ]] || ext="jpg"
local target="$WALLPAPER_DIR/$WALLPAPER_NAME.$ext"
if [[ -s $target ]]; then
info "Wallpaper already downloaded: $target"
WALLPAPER_PATH="$target"
return
fi
info "Downloading wallpaper from $WALLPAPER_URL"
curl -fsSL --retry 3 -o "$target" "$WALLPAPER_URL" || {
warn "Wallpaper download failed; hyprpaper will fall back to no wallpaper."
WALLPAPER_PATH=""
return
}
WALLPAPER_PATH="$target"
return
fi
# Default path: try .jpg then .png against the wallhaven pattern.
local ext target
for ext in jpg png; do
target="$WALLPAPER_DIR/$WALLPAPER_NAME.$ext"
if [[ -s $target ]]; then
info "Wallpaper already downloaded: $target"
WALLPAPER_PATH="$target"
return
fi
done
for ext in jpg png; do
local url="$DEFAULT_WALLPAPER_BASE.$ext"
target="$WALLPAPER_DIR/$WALLPAPER_NAME.$ext"
info "Trying wallpaper: $url"
if curl -fsSL --retry 2 -o "$target" "$url"; then
WALLPAPER_PATH="$target"
return
fi
rm -f "$target"
done
warn "Could not download default wallpaper from $DEFAULT_WALLPAPER_BASE.(jpg|png)."
warn "Set WALLPAPER_URL=<direct-image-url> and re-run install/install.sh --dotfiles-only"
WALLPAPER_PATH=""
}
write_hyprpaper_config() {
local conf="$HOME/.config/hypr/hyprpaper.conf"
mkdir -p "$(dirname "$conf")"
# Back up any pre-existing non-empty config (unless it's already ours).
if [[ -s $conf ]] && ! grep -q '^# Generated by dotfiles install/lib/wallpaper.sh' "$conf"; then
local backup="$conf.pre-install.$(date +%s)"
cp "$conf" "$backup"
info "Backed up existing hyprpaper.conf -> $backup"
fi
if [[ -z ${WALLPAPER_PATH:-} ]]; then
# No image — write a no-op config so hyprpaper starts cleanly.
cat >"$conf" <<'EOF'
# Generated by dotfiles install/lib/wallpaper.sh
# No wallpaper configured. Set WALLPAPER_URL and re-run install.sh, or
# add `preload = <path>` and `wallpaper = ,<path>` lines below.
splash = false
ipc = on
EOF
info "Wrote stub hyprpaper.conf (no wallpaper)"
return
fi
cat >"$conf" <<EOF
# Generated by dotfiles install/lib/wallpaper.sh
preload = $WALLPAPER_PATH
wallpaper = ,$WALLPAPER_PATH
splash = false
ipc = on
EOF
info "Wrote hyprpaper.conf -> $WALLPAPER_PATH"
}
setup_wallpaper() {
download_wallpaper
write_hyprpaper_config
}