#!/usr/bin/env bash

if ( ! command -v convert >/dev/null 2>&1 ); then
    echo -e "\"Convert\" is required but it's not installed."
    echo -e "Install \"imagemagick\" package and retry."
    exit 1
fi

case $XDG_CURRENT_DESKTOP in
    "X-Cinnamon") DIR_CACHE=~/.cache/wallpaper ;;
    "MATE") DIR_CACHE=~/.cache/mate/background ;;
    *) DIR_CACHE=~/.cache/wallpaper ;;
esac

for f in $(find ${DIR_CACHE} -name "[0-9]_*"); do
    disp_id=$(basename $f | cut -d "_" -f1,3,4)
    convert -pointsize 50 -fill yellow -draw "text 50,100 \"${disp_id}\"" $f $f
done
