--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -469,7 +469,10 @@ const AppMenuButton = new Lang.Class({
             }
         }
 
-        let visible = (this._targetApp != null && !Main.overview.visibleTarget);
+        let hasWindows = (this._targetApp != null && this._targetApp.get_windows().filter(function(w) {
+            return Shell.WindowTracker.is_window_interesting(w);
+        }).length > 0);
+        let visible = (hasWindows && !Main.overview.visibleTarget);
         if (visible)
             this.show();
         else
@@ -502,7 +505,9 @@ const AppMenuButton = new Lang.Class({
 
             menu = new RemoteMenu.RemoteMenu(this.actor, this._targetApp.menu, this._targetApp.action_group);
             menu.connect('activate', Lang.bind(this, function() {
-                let win = this._targetApp.get_windows()[0];
+                let win = this._targetApp.get_windows().filter(function(w) {
+                    return Shell.WindowTracker.is_window_interesting(w);
+                })[0];
                 win.check_alive(global.get_current_time());
             }));
 
