Skip to content

Conversation

@brichet
Copy link
Collaborator

@brichet brichet commented Dec 17, 2025

This PR allows to open a console next to a Notebook (scratch-pad like), sharing the same kernel.

image

there are several way to open it from a Notebook view:

  • from the menu menu>new>Scratch-pad console
  • from the commands palette
  • from the shortcut Ctrl + B

Fixes #7707

Remaining tasks:

@github-actions
Copy link
Contributor

Binder 👈 Launch a Binder on branch brichet/notebook/scratchpad-console

@brichet
Copy link
Collaborator Author

brichet commented Dec 18, 2025

do not toggle the side panel after the command is executed

When the command is executed, it seems that a activateById is called on the shell. In Notebook, this commands hide the side panel if it is already display (see #7534 for more context).

We can see in the screen recording below that the command is executed, though, but the console needs to be reopened.

record-2025-12-18_16.03.53.webm

Comment on lines +119 to +126
app.commands
.listCommands()
.filter((id) => COMMANDS_TO_PATCH.includes(id))
.forEach((id) => {
(app.commands as any)._commands.get(id).isEnabled = () =>
tracker.currentWidget !== null &&
tracker.currentWidget.node.contains(document.activeElement);
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

allow the console commands to run in the side panel

This patch updates the isEnabled function for the commands, to allow running the commands in the side panel.
It should be fixed with jupyterlab/jupyterlab#18238.

"@jupyter-notebook/notebook-extension": true,
"@jupyter-notebook/terminal-extension": true,
"@jupyterlab/application-extension": [
"@jupyterlab/application-extension:commands",
Copy link
Collaborator Author

@brichet brichet Dec 18, 2025

Choose a reason for hiding this comment

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

This extension is not enabled anymore, except for the tree view, because it already uses the Ctrl + B shortcut.
AFAIK the commands in this extension may not be necessary for the Notebook view (not sure it is necessary at all, most of them requires a LabShell to work).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scratchpad-like workflow

1 participant