Last active
March 30, 2024 18:06
-
-
Save TechnoSparks/948e62408286436eb0fd10dc403381c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# IP address of android device | |
adbip='192.168.1.101:2109' | |
# resolution/dpi of second screen | |
resdpi='1920x1000/180' | |
# args to pass for scrcpy | |
scrcpyargs='-S -b 16M --power-off-on-close --video-codec=h265 -K -w' | |
errorf() { | |
echo "Error occured." | |
read -p "Press any key to continue" | |
exit | |
} | |
echo Connect via WADB | |
adb connect $adbip || errorf | |
echo Spawning second display | |
adb shell settings put global overlay_display_devices $resdpi || errorf | |
echo Identifying display ID | |
id=$(scrcpy.exe --list-displays | awk -F '=' '/display-id/ && ++count == 2 {split($2, id, /[[:space:]]/); print id[1]}') | |
scrcpy $scrcpyargs --display-id $id || errorf | |
echo Destroying second display | |
adb shell settings put global overlay_display_devices none || errorf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
nircmd exec hide busybox bash launch.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment