diff --git a/packages/lab-extension/src/index.ts b/packages/lab-extension/src/index.ts index 9bc389548..d358561f7 100644 --- a/packages/lab-extension/src/index.ts +++ b/packages/lab-extension/src/index.ts @@ -2,6 +2,7 @@ // Distributed under the terms of the Modified BSD License. import { + ILabShell, JupyterFrontEnd, JupyterFrontEndPlugin } from '@jupyterlab/application'; @@ -73,15 +74,17 @@ class ClassicButton const openClassic: JupyterFrontEndPlugin = { id: '@jupyterlab-classic/lab-extension:open-classic', autoStart: true, - optional: [INotebookTracker, ICommandPalette, IMainMenu], + optional: [INotebookTracker, ICommandPalette, IMainMenu, ILabShell], activate: ( app: JupyterFrontEnd, notebookTracker: INotebookTracker | null, palette: ICommandPalette | null, - menu: IMainMenu | null + menu: IMainMenu | null, + labShell: ILabShell | null ) => { // TODO: do not activate if already in a IClassicShell? - if (!notebookTracker) { + if (!notebookTracker || !labShell) { + // to prevent showing the toolbar button in JupyterLab Classic return; }