Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Don't use app.name to find current shell
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvipanda committed Jun 14, 2021
1 parent f765ad7 commit 3bc1574
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/lab-extension/src/interfaceswitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -87,12 +88,13 @@ class InterfaceSwitcherButton
const interfaceSwitcher: JupyterFrontEndPlugin<void> = {
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
Expand All @@ -115,14 +117,16 @@ const interfaceSwitcher: JupyterFrontEndPlugin<void> = {
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
}
];

Expand Down

0 comments on commit 3bc1574

Please sign in to comment.