add support for Wayland-screenshots

This commit is contained in:
RobbStarkAustria
2026-03-29 13:10:33 +02:00
parent c4bd27510c
commit 5d32b0a3eb

View File

@@ -20,6 +20,34 @@ fi
# Create log directory if it doesn't exist # Create log directory if it doesn't exist
mkdir -p logs mkdir -p logs
# Set up display environment for screenshots
# Required for X11/Wayland screenshot capture when started from SSH
export DISPLAY="${DISPLAY:-:0}"
export XAUTHORITY="${XAUTHORITY:-$HOME/.Xauthority}"
# Wayland sessions also need runtime dir and display socket.
USER_UID="$(id -u)"
if [ -z "$XDG_RUNTIME_DIR" ] && [ -d "/run/user/$USER_UID" ]; then
export XDG_RUNTIME_DIR="/run/user/$USER_UID"
fi
if [ -z "$WAYLAND_DISPLAY" ] && [ -n "$XDG_RUNTIME_DIR" ] && [ -d "$XDG_RUNTIME_DIR" ]; then
if [ -S "$XDG_RUNTIME_DIR/wayland-0" ]; then
export WAYLAND_DISPLAY="wayland-0"
else
WAYLAND_SOCKET="$(find "$XDG_RUNTIME_DIR" -maxdepth 1 -type s -name 'wayland-*' | head -n 1)"
if [ -n "$WAYLAND_SOCKET" ]; then
export WAYLAND_DISPLAY="$(basename "$WAYLAND_SOCKET")"
fi
fi
fi
if [ -n "$WAYLAND_DISPLAY" ]; then
export XDG_SESSION_TYPE="wayland"
fi
echo "📺 Display env: DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY WAYLAND_DISPLAY=${WAYLAND_DISPLAY:-<unset>} XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-<unset>}"
# Start simclient.py with nohup (persists after SSH disconnect) # Start simclient.py with nohup (persists after SSH disconnect)
echo "Starting simclient.py..." echo "Starting simclient.py..."
nohup ./scripts/start-dev.sh > logs/simclient.log 2>&1 & nohup ./scripts/start-dev.sh > logs/simclient.log 2>&1 &
@@ -28,7 +56,7 @@ echo "✓ simclient.py started (PID: $SIMCLIENT_PID)"
# Start display_manager.py with nohup (persists after SSH disconnect) # Start display_manager.py with nohup (persists after SSH disconnect)
echo "Starting display_manager.py..." echo "Starting display_manager.py..."
nohup ./scripts/start-display-manager.sh > logs/display_manager.log 2>&1 & nohup env DISPLAY="$DISPLAY" XAUTHORITY="$XAUTHORITY" WAYLAND_DISPLAY="$WAYLAND_DISPLAY" XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR" XDG_SESSION_TYPE="$XDG_SESSION_TYPE" ./scripts/start-display-manager.sh > logs/display_manager.log 2>&1 &
DISPLAY_PID=$! DISPLAY_PID=$!
echo "✓ display_manager.py started (PID: $DISPLAY_PID)" echo "✓ display_manager.py started (PID: $DISPLAY_PID)"