feat(wallpaper): sync selected wallpaper to hyprlock per monitor

wallpaper-picker now calls write_hyprlock_state() on apply, writing
per-monitor background blocks to ~/.config/hypr/hyprlock-backgrounds.conf.
hyprlock.conf sources that file instead of a hardcoded background block,
with a committed default for first-boot.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main
Amir Alexander Abdelbaki 2026-05-31 21:54:19 +02:00
parent da0d318022
commit 08c3097a70
6 changed files with 64 additions and 22 deletions

View File

@ -0,0 +1,12 @@
# default — overwritten by ~/.config/scripts/wallpaper-picker
background {
monitor =
path = ~/Pictures/background.jpg
blur_size = 6
blur_passes = 2
noise = 0.015
contrast = 1.25
brightness = 0.85
vibrancy = 0.2
vibrancy_darkness = 0.1
}

View File

@ -12,17 +12,8 @@ auth {
fingerprint:enabled = true fingerprint:enabled = true
} }
background { # per-monitor backgrounds written by ~/.config/scripts/wallpaper-picker
monitor = source = ~/.config/hypr/hyprlock-backgrounds.conf
path = ~/Pictures/background.jpg
blur_size = 6
blur_passes = 2
noise = 0.015
contrast = 1.25
brightness = 0.85
vibrancy = 0.2
vibrancy_darkness = 0.1
}
input-field { input-field {
monitor = monitor =

View File

@ -7,6 +7,7 @@ set -u
VERBOSE=0 VERBOSE=0
DIR="" DIR=""
STATE_FILE="${HOME}/.config/wallpaper.conf" STATE_FILE="${HOME}/.config/wallpaper.conf"
HYPRLOCK_BG_FILE="${HOME}/.config/hypr/hyprlock-backgrounds.conf"
FIT_MODE="cover" FIT_MODE="cover"
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
@ -14,6 +15,7 @@ while [[ $# -gt 0 ]]; do
-v|--verbose) VERBOSE=1 ;; -v|--verbose) VERBOSE=1 ;;
--fit) shift; FIT_MODE="$1" ;; --fit) shift; FIT_MODE="$1" ;;
--state) shift; STATE_FILE="$1" ;; --state) shift; STATE_FILE="$1" ;;
--hyprlock-bg) shift; HYPRLOCK_BG_FILE="$1" ;;
*) DIR="$1" ;; *) DIR="$1" ;;
esac esac
shift shift
@ -178,6 +180,21 @@ write_state() {
vlog "wrote $STATE_FILE" vlog "wrote $STATE_FILE"
} }
write_hyprlock_state() {
local mon path tmp
tmp=$(mktemp "${HYPRLOCK_BG_FILE}.XXXXXX") || return 1
{
printf '# generated by wallpaper-picker — do not edit by hand\n'
for mon in "${MONITORS[@]}"; do
path="${CURRENT[$mon]:-}"
[[ -z "$path" ]] && continue
printf 'background {\n monitor = %s\n path = %s\n blur_size = 6\n blur_passes = 2\n noise = 0.015\n contrast = 1.25\n brightness = 0.85\n vibrancy = 0.2\n vibrancy_darkness = 0.1\n}\n' \
"$mon" "$path"
done
} > "$tmp" && mv -f "$tmp" "$HYPRLOCK_BG_FILE"
vlog "wrote $HYPRLOCK_BG_FILE"
}
apply() { apply() {
local path="$1" local path="$1"
local out rc local out rc
@ -216,6 +233,7 @@ apply() {
done done
write_state write_state
write_hyprlock_state
return 0 return 0
} }

View File

@ -0,0 +1,12 @@
# default — overwritten by ~/.config/scripts/wallpaper-picker
background {
monitor =
path = ~/Pictures/background.jpg
blur_size = 6
blur_passes = 2
noise = 0.015
contrast = 1.25
brightness = 0.85
vibrancy = 0.2
vibrancy_darkness = 0.1
}

View File

@ -12,17 +12,8 @@ auth {
fingerprint:enabled = true fingerprint:enabled = true
} }
background { # per-monitor backgrounds written by ~/.config/scripts/wallpaper-picker
monitor = source = ~/.config/hypr/hyprlock-backgrounds.conf
path = ~/Pictures/background.jpg
blur_size = 6
blur_passes = 2
noise = 0.015
contrast = 1.25
brightness = 0.85
vibrancy = 0.2
vibrancy_darkness = 0.1
}
input-field { input-field {
monitor = monitor =

View File

@ -7,6 +7,7 @@ set -u
VERBOSE=0 VERBOSE=0
DIR="" DIR=""
STATE_FILE="${HOME}/.config/wallpaper.conf" STATE_FILE="${HOME}/.config/wallpaper.conf"
HYPRLOCK_BG_FILE="${HOME}/.config/hypr/hyprlock-backgrounds.conf"
FIT_MODE="cover" FIT_MODE="cover"
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
@ -14,6 +15,7 @@ while [[ $# -gt 0 ]]; do
-v|--verbose) VERBOSE=1 ;; -v|--verbose) VERBOSE=1 ;;
--fit) shift; FIT_MODE="$1" ;; --fit) shift; FIT_MODE="$1" ;;
--state) shift; STATE_FILE="$1" ;; --state) shift; STATE_FILE="$1" ;;
--hyprlock-bg) shift; HYPRLOCK_BG_FILE="$1" ;;
*) DIR="$1" ;; *) DIR="$1" ;;
esac esac
shift shift
@ -178,6 +180,21 @@ write_state() {
vlog "wrote $STATE_FILE" vlog "wrote $STATE_FILE"
} }
write_hyprlock_state() {
local mon path tmp
tmp=$(mktemp "${HYPRLOCK_BG_FILE}.XXXXXX") || return 1
{
printf '# generated by wallpaper-picker — do not edit by hand\n'
for mon in "${MONITORS[@]}"; do
path="${CURRENT[$mon]:-}"
[[ -z "$path" ]] && continue
printf 'background {\n monitor = %s\n path = %s\n blur_size = 6\n blur_passes = 2\n noise = 0.015\n contrast = 1.25\n brightness = 0.85\n vibrancy = 0.2\n vibrancy_darkness = 0.1\n}\n' \
"$mon" "$path"
done
} > "$tmp" && mv -f "$tmp" "$HYPRLOCK_BG_FILE"
vlog "wrote $HYPRLOCK_BG_FILE"
}
apply() { apply() {
local path="$1" local path="$1"
local out rc local out rc
@ -216,6 +233,7 @@ apply() {
done done
write_state write_state
write_hyprlock_state
return 0 return 0
} }