Properly restore sidebar position / state on startup.
Use constants for more user default keys.
Fix #1287.