From 362444c782d205cba63987bc5996c475bf056597 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
Date: Wed, 23 Jan 2019 23:55:12 +0100
Subject: [PATCH] panel: Don't allow opening hidden menus via keybindings

We shouldn't allow toggling menus that aren't supported by the
current session mode, but as indicators are hidden rather than
destroyed on mode switches, it is not enough to check for an
indicator's existence.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/851

patch proved:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=921490

diff --git a/js/ui/panel.js b/js/ui/panel.js
index 318ca52..414994f 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -996,8 +996,8 @@ var Panel = new Lang.Class({
     },
 
     _toggleMenu(indicator) {
-        if (!indicator) // menu not supported by current session mode
-            return;
+        if (!indicator || !indicator.container.visible)
+            return; // menu not supported by current session mode
 
         let menu = indicator.menu;
         if (!indicator.actor.reactive)
