 
     func onSwitchApp() {
         if(startedAt != nil) {
-            NSLog("--> current app: %@", (NSWorkspace.sharedWorkspace().frontmostApplication?.bundleIdentifier)!)
+            currentApp = workspace.frontmostApplication
+            if(currentApp != nil) {
+                NSLog("--> current app: %@", currentApp!.bundleIdentifier!)
+            }
         }
     }
     

        
        dateFormatter.timeZone = NSTimeZone(abbreviation: "GMT")
        
        NSWorkspace.sharedWorkspace().notificationCenter.addObserver(
                self,
                selector: "onSwitchApp",
                name: NSWorkspaceDidActivateApplicationNotification,

    var timer : NSTimer? = nil
    var startedAt : NSDate? = nil
    var currentImage : NSImage? = nil
    var currentApp : NSRunningApplication? = nil
    
    var seconds : NSTimeInterval = 60*55
    
