From 99f0b78dc7c03e77d0ea629f4d3146ef2484bac4 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Mon, 14 Jul 2025 14:38:03 +0200 Subject: [PATCH] autostart webbrowser if logged in on /dev/tty1 --- to_home/.bash_profile | 9 +++++++++ wait_websocket.py | 15 +++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 wait_websocket.py diff --git a/to_home/.bash_profile b/to_home/.bash_profile index 6701181..c8b24f0 100644 --- a/to_home/.bash_profile +++ b/to_home/.bash_profile @@ -24,3 +24,12 @@ boxweb() { } . ~/.config/linse_profile + +if [[ "$(tty)" == "/dev/tty1" && -z "$(pgrep wayfire)" ]]; then + echo "desktop is not running, try to start it" + python ~/boxtools/wait_websocket.py + if [[ -z "$(pgrep wayfire)" ]]; then + echo "start desktop (wayfire)" + wayfire + fi +fi diff --git a/wait_websocket.py b/wait_websocket.py new file mode 100644 index 0000000..08e6617 --- /dev/null +++ b/wait_websocket.py @@ -0,0 +1,15 @@ +import time +import socket + +show = True +for _ in range(30): + try: + socket.create_connection(('localhost', 8010), timeout=1) + break + except Exception as e: + time.sleep(1) + if show: + print('waiting for frappy websocket') + show = False +else: + print('failed')