答案1
1. 创建ipynb.xml
mime-info 文件
<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"/>
</mime-type>
</mime-info>
然后将文件存储进去~/.local/share/mime
并更新 mime 数据库。
cp ipynb.xml ~/.local/share/mime
update-mime-database ~/.local/share/mime
2. 创建jupyter.desktop
文件
警告:编辑路径以使其适合您的系统和习惯。
[Desktop Entry]
Version=1.0
Type=Application
Name=Jupyter
Icon="$HOME/.icons/jupyter-sq-text.svg"
Exec=/path/to/jupyter notebook %F
Path="$HOME/Documents/Notebooks"
Comment=Jupyter notebook
MimeType=application/x-ipynb+json;
Categories=Science;
Terminal=true
然后安装桌面文件:
desktop-file-install --dir="$HOME/.local/share/applications" jupyter.desktop
3.添加jupyter图标
我从 jupyter 的设计存储库中选择了 svg 版本,并安装在~/.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
最后将 mime-type 图标链接到系统:
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
希望有帮助!
答案2
对于运行 Jupyter 笔记本,您可能更喜欢上述方法。
至于预览笔记本,我建议你看一下nb-查看器.有了它,您可以双击预览 Jupyter Notebook。