Implement layout switching

We now have an object that stores per-screen layout configuration
options, as well as the layout functions.