diff options
| author | name <[email protected]> | 2026-10-31 16:08:39 +0100 |
|---|---|---|
| committer | name <[email protected]> | 2026-10-31 16:08:39 +0100 |
| commit | 8f0d296c321854308d7e349ec0c76b95cfbbc797 (patch) | |
| tree | 0ce79cff996e7a5e0a25928ee4f70cd6f5267a10 /home-manager | |
| parent | 258feb5d5b0d01852da3c6b767ea85fb9100e9f9 (diff) | |
| download | nixos-8f0d296c321854308d7e349ec0c76b95cfbbc797.tar.xz nixos-8f0d296c321854308d7e349ec0c76b95cfbbc797.zip | |
wallpaper scrript is device agnostic now
Diffstat (limited to 'home-manager')
| -rwxr-xr-x | home-manager/scripts/matugen-sync.sh | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/home-manager/scripts/matugen-sync.sh b/home-manager/scripts/matugen-sync.sh index 5ae80e3..4a469d9 100755 --- a/home-manager/scripts/matugen-sync.sh +++ b/home-manager/scripts/matugen-sync.sh @@ -1,18 +1,23 @@ #!/usr/bin/env bash -# We watch the state file that contains the actual text path of the wallpaper +# We watch the wallpaper state directory; Serpantinum writes monitor-specific +# files like current_DP-2 or current_eDP-1. STATE_DIR="$HOME/.cache/serpantinum/wallpaper/" -STATE_FILE="current_DP-2" inotifywait -m -e close_write "$STATE_DIR" | while read -r directory events filename; do - if [ "$filename" = "$STATE_FILE" ]; then + # Only react to monitor pointer files like current_DP-2, current_eDP-1, + # current_HDMI-A-1. Ignore binary/image/json side files. + if [[ "$filename" =~ ^current_[[:alnum:]]+-[[:alnum:]-]+$ ]]; then # Give Serpantinum a split second to finish its operations sleep 0.5 - # Read the real path of the image from the text file - WP_PATH=$(cat "$STATE_DIR$STATE_FILE") + # Read one line from the monitor pointer file. + IFS= read -r WP_PATH < "$STATE_DIR$filename" + + # Skip empty, non-absolute, or missing paths. + [[ -n "$WP_PATH" && "$WP_PATH" = /* && -f "$WP_PATH" ]] || continue # 1. Run Matugen against the ORIGINAL valid image file matugen image "$WP_PATH" |
