Improved window manager and layout

- Window manager now changes focus on click
- History & Layout containers adapt to screen height
Fix pixelate effect

var i was undefined
Display error when loading with no file selected