     //  MARK:- Lifecyle
 
     func applicationShouldOpenUntitledFile(_ sender: NSApplication) -> Bool {
-        return true//NSApp.windows.count == 0
-    }
+        let dc = NSDocumentController.shared()
+        return dc.documents.count == 0
+     }
 
     let toHMS = hmsTransformer()
     let rectToString = rectTransformer()


            //  If it's a "h3w" type read it and load its fileURL
            if fileType == "h3w" {
                (doc as! Document).updateURL(to: fileURL, ofType: fileType)
                
                (hwc.contentViewController as! WebViewController).loadURL(url: (doc as! Document).fileURL!)
            }

            }
            histories.append(item)
            item.rank = histories.count
            
            //  keep a global play items list used to restore settings
            var lists = UserDefaults.standard.dictionary(forKey: UserSettings.Playitems.default) ?? NSDictionary.init() as! [String : Any]
            lists[item.name] = item.dictionary()
            
            UserDefaults.standard.set(lists, forKey: UserSettings.Playitems.default)
            UserDefaults.standard.synchronize()
            
            //  tell any playlist controller we have updated history
            let notif = Notification(name: Notification.Name(rawValue: "HeliumNewHistoryItem"), object: item)
            NotificationCenter.default.post(notif)
        }
