         let dir = self.params["directory"] as String
         self.task.start("open " + dir + ";")
     }
+    
+    // MARK: - menu delegate
+    
+    func menuWillOpen(menu: NSMenu) {
+        if ( self.task.isRunning() ) {
+            menu.itemWithTag(MenuItem.Start.rawValue)?.hidden = true
+            menu.itemWithTag(MenuItem.Stop.rawValue)?.hidden = false
+        }
+        else {
+            menu.itemWithTag(MenuItem.Start.rawValue)?.hidden = false
+            menu.itemWithTag(MenuItem.Stop.rawValue)?.hidden = true
+        }
+    }
 }

                    action: Selector(item["action"] as String),
                    keyEquivalent: item["key"] as String)
                menuItem.target = self
            }
            self.addItem(menuItem)
        }

    init(params: [String: AnyObject]) {
        super.init()
        
        self.delegate = self
        self.params = params
        self.initMenuItems()
        
