28 lines
1.0 KiB
Bash
Executable File
28 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
SCREENSHOT_DIR="$(dirname "$0")/../screenshots"
|
|
mkdir -p "$SCREENSHOT_DIR"
|
|
|
|
# Ensure DISPLAY is set for screenshot capture
|
|
if [ -z "$DISPLAY" ]; then
|
|
export DISPLAY=:0
|
|
fi
|
|
|
|
# Test screenshot capture
|
|
echo "Testing screenshot capture with DISPLAY=$DISPLAY"
|
|
if scrot "$SCREENSHOT_DIR/test_$(date +%Y%m%d_%H%M%S).png" 2>/dev/null; then
|
|
echo "✅ Screenshot captured successfully"
|
|
echo "📁 Screenshot saved to: $SCREENSHOT_DIR"
|
|
ls -la "$SCREENSHOT_DIR"/test_*.png | tail -1
|
|
else
|
|
echo "❌ Screenshot failed with scrot, trying imagemagick..."
|
|
if import -window root "$SCREENSHOT_DIR/test_$(date +%Y%m%d_%H%M%S).png" 2>/dev/null; then
|
|
echo "✅ Screenshot captured with imagemagick"
|
|
echo "📁 Screenshot saved to: $SCREENSHOT_DIR"
|
|
ls -la "$SCREENSHOT_DIR"/test_*.png | tail -1
|
|
else
|
|
echo "❌ Screenshot capture failed. Check DISPLAY variable and X11 access."
|
|
echo "💡 Try: export DISPLAY=:0"
|
|
echo "💡 Or run from local Pi terminal instead of SSH"
|
|
fi
|
|
fi
|