1. Overview

In this post, we'll see how to change browser tab title for JupyterLab/Jupyter Notebook.

Our objective will be to change the tab names, the icon and the organization of multiple JupyterLab instances.

2. Set Tab name for new JupyterLab environment

If you are starting a new JupyterLab environment you can set up a name by using the next command:

jupyter-lab build --name='new_jupy_env'

This will take some time in order to build the new environment. Once it is ready it will have the name 'new_jupy_env' - which will be displayed as tab name.

3. Set Tab title for existing JupyterLab/Jupyter Notebook

Next we will change the title of the tab for the existing JupyterLab/Jupyter Notebook.

Note that this title update is persistent for new sessions.

3.1. Change tab name with JavaScript

The tab name can be changed by using JavaScript in your browser. For this purpose follow next steps(Chrome):

  • Open the JupyterLab tab
  • Open the developer menu of Chrome - F12
  • Go to Console
  • Change the title by

document.title='my_jupy_env'

3.2. Change tab name in JupyterLab Notebook

Tab name can be changed from JupyterLab notebook by running next command in notebook or Python script:

from IPython.display import display,Javascript
Javascript('document.title="{}"'.format('my_jupy_env'))

This change will survive after:

  • browser restart
  • restart of the server

and will override the name of the build

4. Organize JupyterLab tab names with extensions

Finally, let's cover the option to organize multiple tabs for the same server. Let's say that we have the next sessions started in different:

  • http://localhost:8888/lab/workspaces/auto-V/ - few financial notebooks
  • http://localhost:8888/lab/workspaces/auto-D/ - science notebooks
  • http://localhost:8888/lab/workspaces/auto-r/ - experimental notebooks

In those sessions we have different notebooks - grouped by area of use.

4.1 Tab Modifier for Chrome

To change the tab titles for each of them we can use browser extension like: Tab Modifier - currently working on Chrome and Opera.

We can add rules - to change the tab name - for each of them by providing:

  • new tab name
  • what is the URL of the tab
  • new icon

And finally we can have multiple rules for each tab:

change-browser-tab-title-jupyterlab-tab-modifier

The advantage of this method is that you can:

  • organize multiple tab
  • pin the tab
  • protect the tab from closing

4.2 Tab Modifier for Firefox

For Firefox I was using the extension: Tab ReTitle.

It helped to rename tabs which persisted several restarts of the browser and the server.

But it wasn't stable in the long term.

5. Conclusion

We saw several options to change the tab title. We tested which one preserves the tab name and which does not.

We covered how to organize JupyterLab notebooks in order to group them by logic. As a bonus we saw how to pin, protect and change the icon for JupyterLab.