#!/bin/sh

IP=$(ip route | grep default | awk '{print $3}')
adb tcpip 5555 >/dev/null 2>&1
adb disconnect >/dev/null 2>&1
sleep 1
adb connect $IP:5555

FIRST_DEVICE=$(adb devices | grep "device$" | head -1 | awk '{print $1}')
scrcpy --disable-screensaver --turn-screen-off --stay-awake -s $FIRST_DEVICE
