Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI modes #781

Merged
merged 7 commits into from
Mar 1, 2024
Merged

UI modes #781

merged 7 commits into from
Mar 1, 2024

Conversation

mbektas
Copy link
Member

@mbektas mbektas commented Feb 26, 2024

  • Adds UI mode switch to session menu. UI mode is saved per project (working directory).

  • Zen Mode is the simplified Single document mode. It is an alternative to Classic Notebook view.

  • Custom mode is the default mode that comes with JupyterLab and restores user's layout configuration. Other modes reset the layout based on the selection whenever a new session is created.

  • Introduce UI modes

  • Make Zen Mode default for opening single notebook files by double clicking or from CLI

  • Expose UI modes in settings dialog and CLI

cc. @bollwyvl I looked into supporting Jupyter Notebook mode but it was not feasible. It didn't seem to worth the effort. The Zen Mode introduced in this PR is a good alternative for Classic Notebook view fans.

ui-modes-2

zen-mode-ui

await this._view.webContents.executeJavaScript(`
executeJSResult_currentLayout = {};
{
const lab = window.jupyterapp || window.jupyterlab;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should make the code below into a proper Jupyter extension and make it expose a single command on the window, like window.setJupyterLabMode('zen' | 'multi' | 'single'). This would ensure that as we update versions the type validation catches any changes, and allow re-using it elsewhere. This could be an extension or set of extensions in this repo, or even plugins which might be disabled by default in jupyterlab repo.

My main motivation would be to ultimately revert the change which exposed jupyterapp on window e.g. to avoid users writing logic which assumes that it is there (it will not be available outside of Desktop).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that makes sense. I was also thinking about exposing desktop API endpoints (something like window.jlabDesktopApp.), so that extensions can use. I will create a separate issue for such refactoring.

@krassowski
Copy link
Member

Looks amazing btw!

@mbektas mbektas marked this pull request as ready for review February 28, 2024 04:52
@mbektas mbektas merged commit 6b27752 into master Mar 1, 2024
4 checks passed
@mbektas mbektas deleted the ui-modes branch March 1, 2024 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants