Running Jupyter Lab in application mode
Usually Jupyter Lab runs local server and opens in default browser as a separate tab. It implies all web related parts of the browser, which shrink accessible workspace. One of the ways to make work in Jupyter more comfortable is to run it in app mode.
App mode in Chrome
We can use Chrome properties and run it in app mode. It removes all UI elements related to web browsing. Running Jupyter Lab this way gives user more RStudio or Spyder like experience, resembling normal desktop applications.
First we need to run our application with --no-browser
option to prevent Jupyter Lab from running default system browser
… which should run application server:
Copy the URL with token and open another terminal to run Chrome application in the app mode. Location of Chrome executable may differ for particular distribution, but in .rpm family (CentOS, Fedora, RH) it is located in /opt/google/chrome/google-chrome
. In Windows OS, executable resides in the standard app folder: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
. When running chrome in app mode we need to specify URL to connect. We should paste URL copied from first terminal:
Make it permanent
Copying URL and pasting it in other terminal instance is cumbersome and counterproductive. In order to make Jupyter Lab to always start this way we need to change jupyter settings. Depending on OS they are located in either c:\Users\<User>\.jupyter
or ~/.jupyter
for Windows or Linux OS respectively. File with all jupyter options is named: jupyter_notebook_config.py
. It is not created by default and sometimes we will need to create one for our jupyter app.
To create config file type:
This should generate file located in ~/.jupyter/jupyter_notebook_config.py
or %UserProfile%\.jupyter\jupyter_notebook_config.py
.
To make jupyter always running using chrome browser in app mode, we simply add this specific line somewhere in the file:
RedHat Family Linux
Windows
Because Windows has spaces in “vendor” created folders it must be surrounded by additional double quotes around binary file location, to allow python evaluate path properly. String substitution will allow to capture current URL (with unique token) and place it in correct position when app starts.
Happy hacking!