autostart webbrowser if logged in on /dev/tty1

This commit is contained in:
2025-07-14 14:38:03 +02:00
parent 4d94e56a0a
commit 99f0b78dc7
2 changed files with 24 additions and 0 deletions

View File

@@ -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

15
wait_websocket.py Normal file
View File

@@ -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')