     func windowDidMove(_ notification: Notification) {
         if (notification.object as! NSWindow) == self.window {
             self.doc?.settings.rect.value = (self.window?.frame)!
-        }
-    }
-
+            if let doc = self.doc, let url = (doc as Document).url {
+                defaults.set((doc as Document).dictionary(), forKey: url.absoluteString)
+                doc.updateChangeCount(.changeDone)
+            }
+        }
+    }
+    func windowWillResize(_ sender: NSWindow, to frameSize: NSSize) -> NSSize {
+        if sender == self.window {
+            var frame = sender.frame
+            frame.size = frameSize
+
+            settings.rect.value = frame
+            if let doc = self.doc, let url = (doc as Document).url {
+                defaults.set((doc as Document).dictionary(), forKey: url.absoluteString) 
+                doc.updateChangeCount(.changeDone)
+            }
+        }
+        return frameSize
+    }
+    
     func windowWillClose(_ notification: Notification) {
         self.webViewController.webView.stopLoading()
         


class HeliumPanelController : NSWindowController,NSWindowDelegate {

    var webViewController: WebViewController {
        get {
            return self.window?.contentViewController as! WebViewController


    //MARK:- Notifications
    @objc func willUpdateAlpha() {
        didUpdateAlpha(settings.opacityPercentage.value)
        cacheSettings()
    }
    @objc func willUpdateTranslucency() {
        translucencyPreference = settings.translucencyPreference.value
        updateTranslucency()
        cacheSettings()
    }
    
    func windowDidResize(_ notification: Notification) {
