Uses XineramaDump

Still a work in progress

# Compute the full canvas size, and the size of each display
canvas_size() {
  xwininfo -root | sed -e '
    /^ *\(Width\|Height\)/ {
      s/: /=/;
      H
    };
    /./d;
    $ {
      g;
      s/\n/ /g;
      s/^\(.*\)$/\L\1/
    };
    /^$/d
  '
}

canvas=$(eval $(canvas_size); printf "%ux%u" "${width}" "${height}")
printf "Building canvas (%s)\n" "${canvas}"
convert -size ${canvas} xc:transparent canvas.png

xinerama_dump | while read line
do
  eval ${line}
  printf "Processing screen %u (%ux%u+%u+%u)\n" "${screen}" "${width}" "${height}" "${x_org}" "${y_org}"
  img="$(printf "bg-%u.png" "${screen}")"
  [ -f "${img}" ] || img="${HOME}/.backgrounds/blank.png"
  convert "${img}" -resize ${width}x${height}\! canvas-tmp.png
  composite -geometry +${x_org}+${y_org} canvas-tmp.png canvas.png canvas.png
  rm -f canvas-tmp.png
done

# Reload background
icewmbg -r

exit

# This will take a while. Display a blank background
ln -svf .backgrounds/blank.png ~/.background
icewmbg -r

# Create canvas
convert -size 3360x1080 xc:transparent canvas.png

# Prescale source images
convert ~/.backgrounds/blank.png -resize 1920x1080\! bg-0.png
convert ~/.backgrounds/musicfox-wallpaper.png -resize 1440x900\! bg-1.png

# Composite images onto canvas
composite bg-0.png canvas.png canvas.png
composite -geometry +1920+180 bg-1.png canvas.png canvas.png

# Load newly created background
ln -svf tmp/background/canvas.png ~/.background
icewmbg -r