automatic script calibration when device hdmi cable is disconnected

greetings how can I make my device set the wallpaper when the hdmi cable is pulled out

Probably only with great difficulty.

Can you explain what your ultimate end goal is?

Hi, when disconnect the hdmi cable, it automatically takes the wallpaper that is on the 2nd screen, but I want it to stay on the wallpaper that is available on the internal screen