From f66e3b8818a125fefd9b35f2dbc46deb6ec615ef Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Tue, 15 Jun 2021 03:11:01 +0530 Subject: [PATCH] Don't use app.name to find current shell --- packages/lab-extension/src/interfaceswitcher.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/lab-extension/src/interfaceswitcher.tsx b/packages/lab-extension/src/interfaceswitcher.tsx index 4207ab431..4fb1b0bf5 100644 --- a/packages/lab-extension/src/interfaceswitcher.tsx +++ b/packages/lab-extension/src/interfaceswitcher.tsx @@ -14,6 +14,7 @@ import { import { HTMLSelect } from '@jupyterlab/ui-components'; import { CommandRegistry } from '@lumino/commands'; import { IDisposable } from '@lumino/disposable'; +import { IRetroShell } from '@retrolab/application'; import * as React from 'react'; interface ISwitcherChoice { @@ -87,12 +88,13 @@ class InterfaceSwitcherButton const interfaceSwitcher: JupyterFrontEndPlugin = { id: '@retrolab/lab-extension:interface-switcher', autoStart: true, - optional: [INotebookTracker, ICommandPalette, IMainMenu], + optional: [INotebookTracker, ICommandPalette, IMainMenu, IRetroShell], activate: ( app: JupyterFrontEnd, notebookTracker: INotebookTracker | null, palette: ICommandPalette | null, - menu: IMainMenu | null + menu: IMainMenu | null, + retroShell: IRetroShell | null ) => { if (!notebookTracker) { // to prevent showing the toolbar button in RetroLab @@ -115,14 +117,16 @@ const interfaceSwitcher: JupyterFrontEndPlugin = { commandLabel: 'Open in RetroLab', dropdownLabel: 'RetroLab', urlPrefix: `${baseUrl}retro/tree/`, - current: app.name === 'RetroLab' + current: retroShell !== null }, { command: 'retrolab:open-lab', commandLabel: 'Open in JupyterLab', dropdownLabel: 'JupyterLab', urlPrefix: `${baseUrl}lab/tree/`, - current: app.name === 'JupyterLab' + // If we aren't in retroShell, assume we're in JupyterLab + // So any new Lab based UIs will fallback to behaving like JupyterLab + current: retroShell === null } ];