aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.local/bin/chwp25
1 files changed, 13 insertions, 12 deletions
diff --git a/.local/bin/chwp b/.local/bin/chwp
index 5dacc07..60a673b 100755
--- a/.local/bin/chwp
+++ b/.local/bin/chwp
@@ -5,6 +5,7 @@ main()
# Load custom configuration if available
if [ -f "$HOME/.local/etc/x/chwp" ]
then
+ log main "Sourcing $HOME/.local/etc/x/chwp"
. "$HOME/.local/etc/x/chwp"
fi
@@ -13,18 +14,18 @@ main()
timeout=${1:-0}
walldir="$directory/$size"
- log "main" "Checking $walldir for wallpapers"
+ log main "Checking $walldir for wallpapers"
# Fail early if there's no wallpaper directory
if [ ! -d "$walldir" ]
then
- printf "No such directory: %s\n" "$walldir" >&2
+ log main "No such directory: $walldir"
exit 1
fi
CACHEFILE="$(mktemp)"
- log "main" "Using $CACHEFILE as CACHEFILE"
+ log main "Using $CACHEFILE as CACHEFILE"
find "${walldir}" -type f > "$CACHEFILE"
@@ -48,7 +49,7 @@ main()
set_papes()
{
- log "set_papes" "Gathering wallpapers"
+ log set_papes "Gathering wallpapers"
pape="$(make_pape)"
@@ -63,7 +64,7 @@ set_papes()
make_pape()
{
- log "make_pape" "Creating wallpaper"
+ log make_pape "Creating wallpaper"
output="$(mktemp)"
imagelist="$(mktemp)"
@@ -71,14 +72,14 @@ make_pape()
if [ -z "$CHWP_MONITORS" ]
then
- log "make_pape" "Trying to determine screens"
+ log make_pape "Trying to determine screens"
xrandr -q \
| grep -F ' connected ' \
| grep -Eo '[[:digit:]]+x[[:digit:]]+' \
> "$monitorlist"
else
- log "make_pape" "Using \$CHWP_MONITORS for monitorlist"
+ log make_pape "Using \$CHWP_MONITORS for monitorlist"
printf "%s" "$CHWP_MONITORS" \
| tr " " "\n" \
@@ -86,22 +87,22 @@ make_pape()
> "$monitorlist"
fi
- log "make_pape" "Found $(wc -l "$monitorlist" | awk '{ print $1 }') screen(s)"
+ log make_pape "Found $(wc -l "$monitorlist" | awk '{ print $1 }') screen(s)"
while read -r resolution
do
- log "make_pape" "Adding wallpaper for $resolution sized screen"
+ log make_pape "Adding wallpaper for $resolution sized screen"
current_pape=$(get_pape "$resolution")
if [ "$current_pape" = "" ]
then
- log "make_pape" "No wallpapers for $resolution"
+ log make_pape "No wallpapers for $resolution"
current_pape="$(mktemp --tmpdir XXXXX.png)"
convert -size "$resolution" canvas:gray "$current_pape"
else
- log "make_pape" "Using $current_pape"
+ log make_pape "Using $current_pape"
fi
printf '"%s"\n' "$current_pape" >> "$imagelist"
@@ -123,7 +124,7 @@ get_pape()
{
if [ ! -d "$directory/$1" ]
then
- log "get_pape" "$directory/$1 does not exist"
+ log get_pape "$directory/$1 does not exist"
return 1
fi