         let webView = self.window?.contentView?.subviews.first as! MyWebView
 
         if note.object as? URL == webView.url {
-            self.willUpdateTitleBar()
-        }
-    }
-    
-    @objc func willUpdateTitleBar() {
+            self.updateTitleBar()
+        }
+    }
+    
+    @objc func updateTitleBar() {
         if settings.autoHideTitle.value == true && !mouseOver {
-            panel.titleVisibility = NSWindowTitleVisibility.hidden;
+            panel.titleVisibility = NSWindowTitleVisibility.hidden
             panel.titlebarAppearsTransparent = true
-//            panel.styleMask = NSWindowStyleMask(rawValue: NSWindowStyleMask.fullSizeContentView.rawValue + panel.styleMask.rawValue)
-            panel.styleMask = NSWindowStyleMask.borderless
+            self.window!.styleMask.formUnion(.fullSizeContentView)
         } else {
-            panel.titleVisibility = NSWindowTitleVisibility.visible;
-            panel.styleMask = panel.lastStyleMask
-            
+            panel.titleVisibility = NSWindowTitleVisibility.visible
+            self.window!.styleMask.formSymmetricDifference(.fullSizeContentView)
+            self.synchronizeWindowTitleWithDocumentName()
+
             let docIconButton = panel.standardWindowButton(.documentIconButton)
             if let doc = self.document {
                 docIconButton?.image = (doc as! Document).displayImage
-                panel.title = doc.displayName
             }
             else
             {
                 docIconButton?.image = NSApp.applicationIconImage
             }
-            panel.styleMask = panel.lastStyleMask
-            panel.title = (document?.displayName)!
-            
-            self.synchronizeWindowTitleWithDocumentName()
+
         }
     }
     

        settings.opacityPercentage.value = sender.tag
        willUpdateAlpha()
    }

    @IBAction func translucencyPress(_ sender: NSMenuItem) {
        settings.translucencyPreference.value = HeliumPanelController.TranslucencyPreference(rawValue: sender.tag)!
        translucencyPreference = settings.translucencyPreference.value
        willUpdateTranslucency()
    }

    override func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
        switch menuItem.title {
        case "Preferences":

        let webView = self.window?.contentView?.subviews.first as! MyWebView
        let delegate = webView.navigationDelegate as! NSObject
        panel.ignoresMouseEvents = true
        
        //  Halt anything in progress
        (contentViewController as! WebViewController).webView.loadHTMLString("Yoink://", baseURL: nil)
        
        // Wind down all observations
        webView.removeObserver(delegate, forKeyPath: "estimatedProgress")
        NotificationCenter.default.removeObserver(delegate)
