Skip to content

Instantly share code, notes, and snippets.

@Grohden
Last active December 2, 2019 12:01
Show Gist options
  • Save Grohden/e5e3a9ab1b0f454108187e7602e1c73a to your computer and use it in GitHub Desktop.
Save Grohden/e5e3a9ab1b0f454108187e7602e1c73a to your computer and use it in GitHub Desktop.
React native bindings for IDE (jetbrains) keyboard shortcuts
#!/usr/bin/env bash
set -e
# Use this script to bind a keyboard shortcut (I recommend alt+shift+number)
# tools > external tools
# Program: /bin/bash
# # Here is up to you, you can place it on the project or globally
# Arguments .$Projectpath$/scripts/android-dev-bindings.sh reload
# Working directory: $ProjectFileDir$
# Then save/apply/ok and go to keymap > external tools and assign your shortcuts
OPEN_TYPE="$1"
# recommended alt+shift+1
COMMAND_MENU="menu"
# recommended alt+shift+2
COMMAND_RELOAD="reload"
# recommended alt+shift+4
COMMAND_REVERSE="reverse"
if [ -z "$OPEN_TYPE" ]
then :
echo "Command not specified, use either '$COMMAND_MENU', '$COMMAND_RELOAD' or '$COMMAND_REVERSE'"
exit 3
fi
if [ "$OPEN_TYPE" == $COMMAND_MENU ]
then :
echo "Sending open menu command"
adb shell input keyevent 82
exit 0
fi
if [ "$OPEN_TYPE" == $COMMAND_RELOAD ]
then :
echo "Sending reload command"
adb shell input text "RR"
exit 0
fi
if [ "$OPEN_TYPE" == $COMMAND_REVERSE ]
then :
echo "Sending reverse command"
adb reverse tcp:8081 tcp:8081
exit 0
fi
echo "Command specified as '$OPEN_TYPE', use either '$COMMAND_MENU' or '$COMMAND_RELOAD'"
exit 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment