diff --git a/i3/i3/scripts/jupyter-calculator b/i3/i3/scripts/jupyter-calculator index 49707d0..d2d06aa 100755 --- a/i3/i3/scripts/jupyter-calculator +++ b/i3/i3/scripts/jupyter-calculator @@ -41,7 +41,10 @@ def isNotebookRunning(): if __name__ == "__main__": try: if not isNotebookRunning(): - subprocess.Popen(f"jupyter notebook --notebook-dir={NOTEBOOK_DIR} --port={PORT} --no-browser", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + print("No notebook instance running. Starting it...") + subprocess.Popen(f"jupyter notebook --notebook-dir={NOTEBOOK_DIR} --port={PORT} --no-browser", shell=True) + else: + print("Notebook instance already running.") max_wait_seconds = 3 delta_t_seconds = 0.1 @@ -59,8 +62,12 @@ if __name__ == "__main__": if current_wait_seconds >= max_wait_seconds: raise Exception(f"Maximum wait time of {max_wait_seconds} exceeded!") - subprocess.call(f"cp {NOTEBOOK_DIR}calculator_template.ipynb {NOTEBOOK_DIR}calculator.ipynb", shell=True, stdout=None) - subprocess.call(f"electron 'http://localhost:{PORT}/notebooks/calculator.ipynb?token={token}'", shell=True, stdout=None) + subprocess.call(f"cp {NOTEBOOK_DIR}calculator_template.ipynb {NOTEBOOK_DIR}calculator.ipynb", shell=True) + + # url = f"http://localhost:{PORT}/notebooks/calculator.ipynb?token={token}" + url = f"http://localhost:{PORT}/?token={token}" + + subprocess.call(f"$BROWSER '{url}'", shell=True) finally: # TODO: not reliably working