I'm trying to get my dual monitors (connected to a MacBook Pro) to display ultrawide desktop backgrounds spanning them both. I've already made a small script that chops the images in half and puts them in corresponding folders (left and right), but every time I wake my computer from sleep it messes with the order and I get two non-matching pictures. I'd like to control this with a python script instead if possible. So far I've got a script that will change the primary display,
import random
import os
rand = random.randint(1, 25)
left = r'/Users/nickthomas/Documents/Wide_Background_Pics/Left/' + str(rand) + '.jpg'
right = r'/Users/nickthomas/Documents/Wide_Background_Pics/Right/' + str(rand) + '.jpg'
command = '''osascript -e 'tell application "Finder" to set desktop picture to POSIX file "''' + left + '"\''
os.system(command)
But I'm not sure how I can do the same with the second monitor. Can this be done with AppleScript or some other method?