From 08c3097a703f7604855e70acbd62d7877cd85a5a Mon Sep 17 00:00:00 2001 From: The_miro Date: Sun, 31 May 2026 21:54:19 +0200 Subject: [PATCH] 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 --- .../hyprland/hypr/hyprlock-backgrounds.conf | 12 ++++++++++++ desktopenvs/hyprland/hypr/hyprlock.conf | 13 ++----------- desktopenvs/hyprland/scripts/wallpaper-picker | 18 ++++++++++++++++++ .../hyprlua/hypr/hyprlock-backgrounds.conf | 12 ++++++++++++ desktopenvs/hyprlua/hypr/hyprlock.conf | 13 ++----------- desktopenvs/hyprlua/scripts/wallpaper-picker | 18 ++++++++++++++++++ 6 files changed, 64 insertions(+), 22 deletions(-) create mode 100644 desktopenvs/hyprland/hypr/hyprlock-backgrounds.conf create mode 100644 desktopenvs/hyprlua/hypr/hyprlock-backgrounds.conf diff --git a/desktopenvs/hyprland/hypr/hyprlock-backgrounds.conf b/desktopenvs/hyprland/hypr/hyprlock-backgrounds.conf new file mode 100644 index 0000000..32e3eca --- /dev/null +++ b/desktopenvs/hyprland/hypr/hyprlock-backgrounds.conf @@ -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 +} diff --git a/desktopenvs/hyprland/hypr/hyprlock.conf b/desktopenvs/hyprland/hypr/hyprlock.conf index a732edf..918cd2e 100644 --- a/desktopenvs/hyprland/hypr/hyprlock.conf +++ b/desktopenvs/hyprland/hypr/hyprlock.conf @@ -12,17 +12,8 @@ auth { fingerprint:enabled = true } -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 -} +# per-monitor backgrounds written by ~/.config/scripts/wallpaper-picker +source = ~/.config/hypr/hyprlock-backgrounds.conf input-field { monitor = diff --git a/desktopenvs/hyprland/scripts/wallpaper-picker b/desktopenvs/hyprland/scripts/wallpaper-picker index ac7bba9..66cab3c 100755 --- a/desktopenvs/hyprland/scripts/wallpaper-picker +++ b/desktopenvs/hyprland/scripts/wallpaper-picker @@ -7,6 +7,7 @@ set -u VERBOSE=0 DIR="" STATE_FILE="${HOME}/.config/wallpaper.conf" +HYPRLOCK_BG_FILE="${HOME}/.config/hypr/hyprlock-backgrounds.conf" FIT_MODE="cover" while [[ $# -gt 0 ]]; do @@ -14,6 +15,7 @@ while [[ $# -gt 0 ]]; do -v|--verbose) VERBOSE=1 ;; --fit) shift; FIT_MODE="$1" ;; --state) shift; STATE_FILE="$1" ;; + --hyprlock-bg) shift; HYPRLOCK_BG_FILE="$1" ;; *) DIR="$1" ;; esac shift @@ -178,6 +180,21 @@ write_state() { 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() { local path="$1" local out rc @@ -216,6 +233,7 @@ apply() { done write_state + write_hyprlock_state return 0 } diff --git a/desktopenvs/hyprlua/hypr/hyprlock-backgrounds.conf b/desktopenvs/hyprlua/hypr/hyprlock-backgrounds.conf new file mode 100644 index 0000000..32e3eca --- /dev/null +++ b/desktopenvs/hyprlua/hypr/hyprlock-backgrounds.conf @@ -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 +} diff --git a/desktopenvs/hyprlua/hypr/hyprlock.conf b/desktopenvs/hyprlua/hypr/hyprlock.conf index a732edf..918cd2e 100644 --- a/desktopenvs/hyprlua/hypr/hyprlock.conf +++ b/desktopenvs/hyprlua/hypr/hyprlock.conf @@ -12,17 +12,8 @@ auth { fingerprint:enabled = true } -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 -} +# per-monitor backgrounds written by ~/.config/scripts/wallpaper-picker +source = ~/.config/hypr/hyprlock-backgrounds.conf input-field { monitor = diff --git a/desktopenvs/hyprlua/scripts/wallpaper-picker b/desktopenvs/hyprlua/scripts/wallpaper-picker index ac7bba9..66cab3c 100755 --- a/desktopenvs/hyprlua/scripts/wallpaper-picker +++ b/desktopenvs/hyprlua/scripts/wallpaper-picker @@ -7,6 +7,7 @@ set -u VERBOSE=0 DIR="" STATE_FILE="${HOME}/.config/wallpaper.conf" +HYPRLOCK_BG_FILE="${HOME}/.config/hypr/hyprlock-backgrounds.conf" FIT_MODE="cover" while [[ $# -gt 0 ]]; do @@ -14,6 +15,7 @@ while [[ $# -gt 0 ]]; do -v|--verbose) VERBOSE=1 ;; --fit) shift; FIT_MODE="$1" ;; --state) shift; STATE_FILE="$1" ;; + --hyprlock-bg) shift; HYPRLOCK_BG_FILE="$1" ;; *) DIR="$1" ;; esac shift @@ -178,6 +180,21 @@ write_state() { 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() { local path="$1" local out rc @@ -216,6 +233,7 @@ apply() { done write_state + write_hyprlock_state return 0 }