      */
     override init() {
         // Setup 1st Assertion
-        assertion = PowerAssertion(name: "Barista Prevent Sleep", type: .PreventUserIdleSystemSleep, level: .Off)
+        let starttype = NSUserDefaults.standardUserDefaults().valueForKey("allowDisplaySleep") as Bool ?
+            PowerAssertionType.PreventUserIdleSystemSleep : PowerAssertionType.PreventUserIdleDisplaySleep
+        
+        assertion = PowerAssertion(name: "Barista Prevent Sleep", type: starttype, level: .Off)
         if assertion == nil {
             fatalError("Could not create assertion, abort!")
         }

    }

    func toggleDisplaySleep(sender: AnyObject?) {
        if NSUserDefaults.standardUserDefaults().valueForKey("allowDisplaySleep") as Bool {
            assertion?.type = PowerAssertionType.PreventUserIdleDisplaySleep
        } else {
            assertion?.type = PowerAssertionType.PreventUserIdleSystemSleep


        menu.addItem(NSMenuItem.separatorItem())
        menu.addItem(mItemQuit)
    }

    
