Initial import: clean snapshot from /home/olafn/infoscreen-dev (2025-10-25)
This commit is contained in:
27
scripts/test-screenshot.sh
Executable file
27
scripts/test-screenshot.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user