dommi
I got it working with this script:
#!/usr/bin/env bash
set -euo pipefail
RESOLUTION="1920x1080/240"
cleanup() {
echo "Cleaning up overlay display..."
adb shell settings delete global overlay_display_devices >/dev/null 2>&1 || true
}
# Ensure cleanup happens on exit or CTRL+C
trap cleanup EXIT INT TERM
echo "Creating overlay display (${RESOLUTION})..."
adb shell settings put global overlay_display_devices "$RESOLUTION"
# Brief pause to let Android register the new display ID
sleep 1
echo "Detecting display ID..."
# Extract the last reported display ID from scrcpy output
DISPLAY_ID=$(scrcpy --list-displays 2>&1 | grep -- '--display-id=' | tail -n 1 | sed -n 's/.*--display-id=\([0-9]*\).*/\1/p')
if [ -z "$DISPLAY_ID" ]; then
echo "Error: Could not determine display ID."
exit 1
fi
echo "Launching scrcpy on display ID: $DISPLAY_ID"
scrcpy --no-audio --display-id="$DISPLAY_ID"
It creates an overlay display and displays that in scrcpy.
The only Problem with this is that it also shows this overlay also on the phone and i could not find a way to fix this yet.