scripting: Use more VirtualDesktop
VirtualDesktop objects are better than int-based desktop ids as they don't drift if a virtual desktop is added or removed, which makes handling desktop changes easier.
This exposes VirtualDesktop more in the scripting api so we can start phasing out int-based desktop id properties and apis.