diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index 4f7de21..0000000
--- a/Dockerfile
+++ /dev/null
@@ -1,87 +0,0 @@
-FROM jupyter/base-notebook:1386e2046833
-
-USER root
-# Useful tools for debugging connection problems
-RUN apt-get update -y -q && \
- apt-get install -y -q \
- curl \
- net-tools \
- vim
-
-# Desktop environment, keep in sync with jupyter_notebook_config.py
-# ENV DESKTOP_PACKAGE lxde
-ENV DESKTOP_PACKAGE xfce4
-RUN apt-get update -y -q && \
- apt-get install -y -q \
- xterm \
- ${DESKTOP_PACKAGE}
-
-# Don't install distro versions of tigervnc and websockify, instead install
-# upstream versions
-
-# Novnc: just want web files
-RUN cd /opt && \
- curl -sSfL https://github.com/novnc/noVNC/archive/v1.1.0.tar.gz | tar -zxf -
-
-# Patch novnc to use correct path to websockify (defaults to /)
-# Note if you use vnc.html you will need to patch ui.js to use the correct path
-# and also to override localstorage which may store an incorrect path from a
-# different session
-# Also resize server instead of scaling client
-RUN sed -i.bak \
- -e "s%\('path', 'websockify'\)%'path', window.location.pathname.replace(/[^/]*$/, '').substring(1) + 'websockify'); console.log('websockify path:' + path%" \
- -re "s%rfb.scaleViewport = .+%rfb.resizeSession = readQueryVariable('resize', true);%" \
- /opt/noVNC-1.1.0/vnc_lite.html
-
-# Install tigervnc to /usr/local
-RUN curl -sSfL 'https://bintray.com/tigervnc/stable/download_file?file_path=tigervnc-1.9.0.x86_64.tar.gz' | tar -zxf - -C /usr/local --strip=2
-
-USER jovyan
-
-# Custom jupyter-server-proxy to load vnc_lite.html instead of /
-# https://github.com/jupyterhub/jupyter-server-proxy/pull/151
-RUN /opt/conda/bin/pip install https://github.com/manics/jupyter-server-proxy/archive/1f22ccf44abd7ab5f7b306d57b6adb1dc3190e8b.zip
-RUN conda install -y -q -c manics websockify=0.9.0
-
-ADD jupyter_notebook_config.py /home/jovyan/.jupyter/jupyter_notebook_config.py
-
-
-########## Applications
-
-USER root
-RUN apt-get update -y -q && \
- apt-get install -y -q \
- firefox \
- less \
- openjdk-8-jre \
- unzip
-# default-jre is java 11 which is incompatible with Fiji
-
-USER jovyan
-RUN wget -q https://downloads.imagej.net/fiji/latest/fiji-nojre.zip && \
- unzip -q fiji-nojre.zip && \
- echo TODO: rm fiji-nojre.zip
-RUN wget -q https://github.com/ome/omero-insight/releases/download/v5.5.6/OMERO.imagej-5.5.6.zip && \
- cd Fiji.app/plugins && \
- unzip -q ../../OMERO.imagej-5.5.6.zip && \
- echo TODO: rm OMERO.imagej-5.5.6.zip
-
-RUN wget -q https://github.com/ome/omero-insight/releases/download/v5.5.6/OMERO.insight-5.5.6.zip && \
- unzip -q OMERO.insight-5.5.6.zip && \
- echo TODO: rm OMERO.insight-5.5.6.zip
-
-RUN mkdir .java && \
- cd OMERO.insight-5.5.6 && \
- wget -q https://www.openmicroscopy.org/img/logos/omero-logomark.svg
-# https://developer.gnome.org/desktop-entry-spec/
-#COPY --chown=${NB_UID}:${NB_GID} *.desktop /home/jovyan/Desktop/
-COPY --chown=1000:100 *.desktop /home/jovyan/Desktop/
-# Configure default OMERO.insight server list
-#COPY --chown=${NB_UID}:${NB_GID} java_userPrefs .java/.userPrefs
-COPY --chown=1000:100 java_userPrefs .java/.userPrefs
-
-WORKDIR ${HOME}
-
-# Both these should work:
-# http://127.0.0.1:8888/desktop
-# http://localhost:5901/vnc.html
diff --git a/Fiji.desktop b/Fiji.desktop
deleted file mode 100755
index f34415e..0000000
--- a/Fiji.desktop
+++ /dev/null
@@ -1,14 +0,0 @@
-[Desktop Entry]
-Version=1.0
-Name=Fiji Is Just ImageJ
-GenericName=Fiji Is Just ImageJ
-X-GNOME-FullName=Fiji Is Just ImageJ
-Comment=Scientific Image Analysis
-Type=Application
-Categories=Education;Science;ImageProcessing;
-Exec=/home/jovyan/Fiji.app/ImageJ-linux64
-TryExec=/home/jovyan/Fiji.app/ImageJ-linux64
-Terminal=false
-StartupNotify=true
-Icon=/home/jovyan/Fiji.app/images/icon.png
-StartupWMClass=fiji-Main
diff --git a/OMERO.insight.desktop b/OMERO.insight.desktop
deleted file mode 100755
index 5b11a92..0000000
--- a/OMERO.insight.desktop
+++ /dev/null
@@ -1,13 +0,0 @@
-[Desktop Entry]
-Version=1.0
-Name=OMERO.insight
-GenericName=OMERO.insight
-X-GNOME-FullName=OMERO.insight
-Comment=OMERO desktop client
-Type=Application
-Categories=Education;Science;ImageProcessing;
-Exec=/home/jovyan/OMERO.insight-5.5.6/bin/omero-insight
-TryExec=/home/jovyan/OMERO.insight-5.5.6/bin/omero-insight
-Terminal=false
-StartupNotify=true
-Icon=/home/jovyan/OMERO.insight-5.5.6/omero-logomark.svg
diff --git a/README.md b/README.md
index e1c7271..b536163 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,16 @@
-# Jupyter OMERO client Desktop
-[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/manics/jupyter-omeroanalysis-desktop/master?urlpath=Desktop)
+# Jupyter OMERO/Fiji/Napari Desktop
+[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/manics/jupyter-omeroanalysis-desktop/napari-binder?filepath=napari.ipynb)
-Run OMERO clients in a Linux desktop using Jupyter.
+
+Run [OMERO clients](https://www.openmicroscopy.org/omero/downloads/) and [Napari](http://napari.org/) in a Linux desktop using Jupyter.
This is based on https://github.com/ryanlovett/nbnovnc
+Either [run on mybinder.org](https://mybinder.org/v2/gh/manics/jupyter-omeroanalysis-desktop/napari-binder?filepath=napari.ipynb) or build locally with [repo2docker](https://repo2docker.readthedocs.io/):
```
-docker build -t jupyter-omeroanalysis-desktop .
-docker run -it --rm -p 8888:8888 jupyter-omeroanalysis-desktop
+repo2docker .
```
-Open the displayed URL, then go to `/Desktop` e.g. http://localhost:8888/Desktop and if you're lucky you'll see a Linux desktop with icons for OMERO.insight and FIJI.
+Open the displayed URL, then go to `/desktop` e.g. http://localhost:8888/desktop and if you're lucky you'll see a Linux desktop with icons for OMERO.insight and FIJI.
+
+Once the desktop is open go back to the main Jupyter Notebook window, open `napari.ipynb` and execute the cells one at a time. You should see Napari open in the desktop window.
diff --git a/apt.txt b/apt.txt
new file mode 100644
index 0000000..d133c25
--- /dev/null
+++ b/apt.txt
@@ -0,0 +1,8 @@
+dbus-x11
+firefox
+xfce4
+xfce4-panel
+xfce4-session
+xfce4-settings
+xorg
+xubuntu-icon-theme
diff --git a/environment.yml b/environment.yml
new file mode 100644
index 0000000..b2c7016
--- /dev/null
+++ b/environment.yml
@@ -0,0 +1,6 @@
+channels:
+ - manics
+dependencies:
+ - websockify
+ - pip:
+ - https://github.com/jupyterhub/jupyter-server-proxy/archive/0e67e1afd0bab1342443f13bd147a2f8c682e9e0.zip
\ No newline at end of file
diff --git a/java_userPrefs/org/openmicroscopy/prefs.xml b/java_userPrefs/org/openmicroscopy/prefs.xml
deleted file mode 100644
index 8c1f77e..0000000
--- a/java_userPrefs/org/openmicroscopy/prefs.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/java_userPrefs/org/openmicroscopy/shoola/prefs.xml b/java_userPrefs/org/openmicroscopy/shoola/prefs.xml
deleted file mode 100644
index 8c1f77e..0000000
--- a/java_userPrefs/org/openmicroscopy/shoola/prefs.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/java_userPrefs/org/openmicroscopy/shoola/util/prefs.xml b/java_userPrefs/org/openmicroscopy/shoola/util/prefs.xml
deleted file mode 100644
index 8c1f77e..0000000
--- a/java_userPrefs/org/openmicroscopy/shoola/util/prefs.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/java_userPrefs/org/openmicroscopy/shoola/util/ui/login/prefs.xml b/java_userPrefs/org/openmicroscopy/shoola/util/ui/login/prefs.xml
deleted file mode 100644
index 4ae2bd7..0000000
--- a/java_userPrefs/org/openmicroscopy/shoola/util/ui/login/prefs.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
diff --git a/java_userPrefs/org/openmicroscopy/shoola/util/ui/prefs.xml b/java_userPrefs/org/openmicroscopy/shoola/util/ui/prefs.xml
deleted file mode 100644
index 8c1f77e..0000000
--- a/java_userPrefs/org/openmicroscopy/shoola/util/ui/prefs.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/java_userPrefs/org/prefs.xml b/java_userPrefs/org/prefs.xml
deleted file mode 100644
index 8c1f77e..0000000
--- a/java_userPrefs/org/prefs.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/jupyter_desktop.py b/jupyter_desktop.py
new file mode 100644
index 0000000..e63165b
--- /dev/null
+++ b/jupyter_desktop.py
@@ -0,0 +1,26 @@
+import os
+
+
+def setup_desktop():
+ VNC_APPLICATION_DIR = os.path.join(os.getenv('CONDA_DIR'), 'vnc')
+ return {
+ 'command': [
+ 'websockify', '-v',
+ '--web', VNC_APPLICATION_DIR + '/noVNC-1.1.0',
+ '--heartbeat', '30',
+ '5901',
+ '--unix-target', VNC_APPLICATION_DIR + '/socket',
+ '--',
+ VNC_APPLICATION_DIR + '/bin/vncserver',
+ '-verbose',
+ '-xstartup', VNC_APPLICATION_DIR + '/xstartup',
+ '-geometry', '1024x768',
+ '-SecurityTypes', 'None',
+ '-rfbunixpath', VNC_APPLICATION_DIR + '/socket',
+ '-fg',
+ ':1',
+ ],
+ 'port': 5901,
+ 'timeout': 30,
+ 'mappath': {'/': '/vnc_lite.html'},
+ }
diff --git a/jupyter_notebook_config.py b/jupyter_notebook_config.py
deleted file mode 100644
index 69719c0..0000000
--- a/jupyter_notebook_config.py
+++ /dev/null
@@ -1,35 +0,0 @@
-import os
-
-if os.getenv('DESKTOP_PACKAGE') == 'lxde':
- xstartup = 'startlxde'
-elif os.getenv('DESKTOP_PACKAGE') == 'xfce4':
- xstartup = 'xfce4-session'
-else:
- xstartup = 'xterm'
-
-vnc_socket = os.path.join(os.getenv('HOME'), '.vnc', 'socket')
-c.ServerProxy.servers = {
- 'Desktop': {
- 'command': [
- '/opt/conda/bin/websockify',
- '-v',
- '--web', '/opt/noVNC-1.1.0',
- '--heartbeat', '30',
- '5901',
- '--unix-target', vnc_socket,
- '--',
- 'vncserver',
- '-verbose',
- '-xstartup', xstartup,
- '-geometry', '1024x768',
- '-SecurityTypes', 'None',
- '-rfbunixpath', vnc_socket,
- '-fg',
- ':1',
- ],
- 'absolute_url': False,
- 'port': 5901,
- 'timeout': 30,
- 'mappath': {'/': '/vnc_lite.html'},
- }
-}
diff --git a/postBuild b/postBuild
new file mode 100644
index 0000000..d99725a
--- /dev/null
+++ b/postBuild
@@ -0,0 +1,31 @@
+#!/bin/bash
+set -eux
+
+env
+
+VNC_APPLICATION_DIR=$CONDA_DIR/vnc
+mkdir $VNC_APPLICATION_DIR
+pushd $VNC_APPLICATION_DIR
+
+# Novnc: just want web files
+curl -sSfL https://github.com/novnc/noVNC/archive/v1.1.0.tar.gz | tar -zxf -
+
+
+# Install tigervnc
+curl -sSfL 'https://bintray.com/tigervnc/stable/download_file?file_path=tigervnc-1.9.0.x86_64.tar.gz' | tar -zxf - --strip=2
+
+# Patch novnc to use correct path to websockify (defaults to /)
+# Note if you use vnc.html you will need to patch ui.js to use the correct path
+# and also to override localstorage which may store an incorrect path from a
+# different session
+# Also resize server instead of scaling client
+sed -i.bak \
+ -e "s%\('path', 'websockify'\)%'path', window.location.pathname.replace(/[^/]*$/, '').substring(1) + 'websockify'); console.log('websockify path:' + path%" \
+ -re "s%rfb.scaleViewport = .+%rfb.resizeSession = readQueryVariable('resize', true);%" \
+ noVNC-1.1.0/vnc_lite.html
+
+
+cp $REPO_DIR/share/xstartup .
+chmod +x xstartup
+
+pip install $REPO_DIR
\ No newline at end of file
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..696fe21
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,17 @@
+import setuptools
+
+
+setuptools.setup(
+ name="jupyter-desktop-server",
+ # py_modules rather than packages, since we only have 1 file
+ py_modules=['jupyter_desktop'],
+ entry_points={
+ 'jupyter_serverproxy_servers': [
+ 'desktop = jupyter_desktop:setup_desktop',
+ ]
+ },
+ install_requires=['jupyter-server-proxy'],
+ package_data={
+ 'jupyter_desktop': ['desktop/*'],
+ },
+)
diff --git a/share/xstartup b/share/xstartup
new file mode 100644
index 0000000..8bb5d1e
--- /dev/null
+++ b/share/xstartup
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/dbus-launch xfce4-session
diff --git a/start b/start
new file mode 100644
index 0000000..8202042
--- /dev/null
+++ b/start
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -eux
+
+ln -s "$CONDA_DIR/vnc/Desktop"
+
+exec "$@"