The code in this else completely freezes my system when I run the swayidle command to replicate xset dpms force off. No idea if it works on multiple monitors, but for now avoid running when there's 1 monitor.
Also remove the comment with the function name in sway.
44AKDAXYTFUZ2QJZKSYVECXBQRZGEALGW26TTWU22QOR56XQ5A7QC