Hi all, I’m trying to add a main area widget which should open whenever JupyterLab reloads:
export const ExtensionName: JupyterFrontEndPlugin<void> = {
id: extensionID,
autoStart: true,
activate: (app: JupyterFrontEnd) => {
app.commands.addCommand(COMMAND, {
execute: () => {
const content = new MyComponent();
const widget = new MainAreaWidget({content});
widget.title.label = someLabel;
app.shell.add(widget, 'main');
app.shell.activateById(widget.id);
}
});
app.restored.then(async () => {
app.commands.execute(COMMAND);
});
}
};
This works fine when there are no previous notebooks open.
But if a previous notebook is open, lab opens the widget after reloading and navigates back to the previously open notebook in a second or so. I was able to overcome this by setting a timeout before app.commands.execute(COMMAND);
, but I’m looking for a better solution to prevent the tab-switching between the widget and the previously open file.