#!/bin/bash # Wait for X11 socket to be available echo "Waiting for X11 display $DISPLAY..." while [ ! -S /tmp/.X11-unix/X0 ]; do sleep 1 done echo "X11 display found. Initializing D-Bus and starting API server..." # Disable screen blanking xset s off -dpms || true # Initialize a local D-Bus session. This is required for cogctl to communicate with cog. export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --session --print-address --fork) # Start the Node.js API server exec node server.js