Resizable sidebar [WIP]

Fixes #2072.

- [ ] Open sidebar and make the window smaller. There is a width (~ 770px) when the sidebar will disappear.
- [ ] Toolbar is messed up on smaller widths (could potentially be fixed if #4052 is done).
- [ ] Code refactoring.