Recently the project jupyter added the mime-type to the ipynb files: application/x-ipynb+json, and I'd like to launch easily these files without having to allways launch the terminal command:

cd /path/to/notebook
jupyter notebook

So I've adapted this blog post in order to:

  • launch a jupyter-notebook server when double clicking a ipynb file
  • add icon to ipynb files.
  • create a desktop Launcher to easily launch a jupyter notebook from a default folder or dragging and dropping a file or folder.

Here's how it looks, and see my answer below to understand how to do this.

enter image description here


1. Create a ipynb.xml mime-info file

<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
    <mime-type type="application/x-ipynb+json">
        <comment>IPython Notebook</comment>
        <glob pattern="*.ipynb"/> 

Then store the file in ~/.local/share/mime and update the mime database.

cp ipynb.xml ~/.local/share/mime
update-mime-database ~/.local/share/mime

2. Create a jupyter.desktop file

Caution: Edit paths to adapt it to your system and habits.

[Desktop Entry]
Exec=/path/to/jupyter notebook %F
Comment=Jupyter notebook

Then install the desktop file:

desktop-file-install --dir="$HOME/.local/share/applications"  jupyter.desktop

3. Add the jupyter icon

I chose the svg version from the design repository of jupyter, and installed in ~/.local/share/icons

wget https://raw.githubusercontent.com/jupyter/design/master/logo/svg/jupyter-sq-text.svg -o $HOME/.local/share/icons/jupyter-sq-text.svg

Finally, link the mime-type icon to the system:

sudo ln -s $HOME/.local/share/icons/jupyter-sq-text.svg /usr/share/icons/gnome/scalable/mimetypes/application-x-ipynb+json.svg
sudo gtk-update-icon-cache /usr/share/icons/gnome/ -f

Hope that's help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.