Skip to content

Instantly share code, notes, and snippets.

@willycedric
Forked from vshymanskyy/adbremote.sh
Created July 22, 2022 10:05
Show Gist options
  • Save willycedric/ccae05575bb59a75d2e89cc06baf5e96 to your computer and use it in GitHub Desktop.
Save willycedric/ccae05575bb59a75d2e89cc06baf5e96 to your computer and use it in GitHub Desktop.
#!/bin/bash
###
# Requires Null Keyboard https://play.google.com/store/apps/details?id=com.wparam.nullkeyboard
# Author: Volodymyr Shymanskyy
###
brightness=$(adb shell settings get system screen_brightness)
ime=$(adb shell settings get secure default_input_method)
trap restore INT
function setup() {
# Wakeup to process commands faster
adb shell input keyevent KEYCODE_WAKEUP
# Always-on screen
adb shell svc power stayon usb
# Set brightness
adb shell settings put system screen_brightness_mode 0
adb shell settings put system screen_brightness 0
# Disable Keyboard
adb shell ime set com.wparam.nullkeyboard/.NullKeyboard
# Show Touches
adb shell settings put system show_touches 1
}
function restore() {
echo Restoring settings
adb shell svc power stayon false
adb shell settings put system screen_brightness_mode 1
adb shell settings put system screen_brightness $brightness
adb shell ime set org.pocketworkstation.pckeyboard/.LatinIME #$ime
adb shell settings put system show_touches 0
exit 0
}
setup
scrcpy -m 768
restore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment