From c7ca442194c69c2ba0843ca8952328129e806ed8 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Sun, 7 Mar 2021 21:55:34 +0100 Subject: Even more logging for chwp --- .local/bin/chwp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.local/bin/chwp b/.local/bin/chwp index 60a673b..f2d0d18 100755 --- a/.local/bin/chwp +++ b/.local/bin/chwp @@ -55,7 +55,7 @@ set_papes() log set_papes "Setting wallpaper to $pape" - feh --bg-fill "$pape" + feh --bg-fill "$pape" 2>&1 | log_pipe "feh" log set_papes "Cleaning up temporary wallpaper image" @@ -113,7 +113,9 @@ make_pape() # shellcheck disable=SC2046 # shellcheck disable=SC2086 - eval convert +append $(cat $imagelist) "$output" + log make_pape "Combine all resolutions into a single image" + + eval convert +append $(cat $imagelist) "$output" 2>&1 | log_pipe "convert" printf "%s" "$output" @@ -136,4 +138,19 @@ log() printf "[%s] %s: %s\n" "$(date +%FT%T)" "$1" "$2" >&2 } +log_pipe() +{ + pipe_log="$(mktemp)" + + cat - > "$pipe_log" + + while read -r line + do + log "$1" "$line" + done < "$pipe_log" + + rm -fr -- "$pipe_log" + unset pipe_log +} + main "$@" -- cgit v1.1