Skip to content

Commit

Permalink
open jupyter windows in jlab desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
ozpau committed Jan 19, 2025
1 parent 2da301e commit 3d8acbf
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/labview/labview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,28 @@ export class LabView implements IDisposable {

// Open external links in system browser
this._view.webContents.setWindowOpenHandler(({ url }) => {
// if Jupyter Lab wants to open a new window, let it open a new window
const jlab_host = `${sessionConfig.url.protocol}//${sessionConfig.url.host}`
if (url.startsWith(jlab_host)) {
return {
action: 'allow',
createWindow: (options : any) => {
const browserView = new BrowserView(options)
this._parent.window.addBrowserView(browserView)
return browserView.webContents
}
};
} else {
// otherwise open in system browser
shell.openExternal(url);
return { action: 'deny' };
}
});
// TODO:
// 1. Opening jupyter notebook creates a window that is not decorated like main labview.
// This is the same behaviour as the main branch.
// 2. Opening links in jupyter windows opened from jupyter labs has old behaviour
// 3. Opening jupyter lab from jupyter notebook creates an undecorated window.

this._view.setBackgroundColor(
options.isDarkTheme ? DarkThemeBGColor : LightThemeBGColor
Expand Down

0 comments on commit 3d8acbf

Please sign in to comment.