hey thanks for this script it's super useful, works well on X11 but doesn't work on wayland with the following setup:
WM: Sway
Single PC monitor
Monitor connected to USB switcher
When I run the script and then I switch to a laptop via the USB switcher (to continue working on the laptop using the same monitor), the script somehow loses communication with the monitor and fails. This doesn't happen on X11.