Skip to content

Instantly share code, notes, and snippets.

@vshymanskyy
Last active June 23, 2023 13:50
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save vshymanskyy/a44ff7af2848653e91f269910cb9d50f to your computer and use it in GitHub Desktop.
Save vshymanskyy/a44ff7af2848653e91f269910cb9d50f 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
@sharunkumar
Copy link

I created a windows batch script based on this: https://gist.github.com/sharunkumar/ca2cd57936e4bac974578d1e8a6b3cf6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment