Skip to content

Commit 3d8acbf

Browse files
committed
open jupyter windows in jlab desktop
1 parent 2da301e commit 3d8acbf

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/main/labview/labview.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,28 @@ export class LabView implements IDisposable {
6666

6767
// Open external links in system browser
6868
this._view.webContents.setWindowOpenHandler(({ url }) => {
69+
// if Jupyter Lab wants to open a new window, let it open a new window
70+
const jlab_host = `${sessionConfig.url.protocol}//${sessionConfig.url.host}`
71+
if (url.startsWith(jlab_host)) {
72+
return {
73+
action: 'allow',
74+
createWindow: (options : any) => {
75+
const browserView = new BrowserView(options)
76+
this._parent.window.addBrowserView(browserView)
77+
return browserView.webContents
78+
}
79+
};
80+
} else {
81+
// otherwise open in system browser
6982
shell.openExternal(url);
7083
return { action: 'deny' };
84+
}
7185
});
86+
// TODO:
87+
// 1. Opening jupyter notebook creates a window that is not decorated like main labview.
88+
// This is the same behaviour as the main branch.
89+
// 2. Opening links in jupyter windows opened from jupyter labs has old behaviour
90+
// 3. Opening jupyter lab from jupyter notebook creates an undecorated window.
7291

7392
this._view.setBackgroundColor(
7493
options.isDarkTheme ? DarkThemeBGColor : LightThemeBGColor

0 commit comments

Comments
 (0)