By the way - I do this with my monitors (One CEC, one not using bookworm):
Off:
pm2 stop all
DISPLAY=:0 xrandr --output HDMI-1 --off
DISPLAY=:0 xrandr --output HDMI-2 --off
echo 'standby 0' | cec-client -s -d 1
On:
echo 'on 0' | cec-client -s -d 1
sleep 20
DISPLAY=:0 xrandr --output HDMI-1 --auto
sleep 1
DISPLAY=:0 xrandr --output HDMI-2 --auto --right-of HDMI-1
sleep 1
pm2 restart all
I have to stop and start the mirror(s) because if I don’t, they’ll move on top of each other.