I’ve written a Hammerspoon Spoon that makes it easy to save and switch desktop contexts/layouts without writing a bunch of macros/actions in Keyboard Maestro.
This GIF should make it easier to understand -
Switching Contexts Demo
You can download it from Layouts.spoon
The README has instructions on installation and how to use either the menubar,keyboard or URL to switch contexts.