Skip to content

Instantly share code, notes, and snippets.

@Geofferey
Created June 24, 2023 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Geofferey/98ae520646fc8ff14485be53e2576b5a to your computer and use it in GitHub Desktop.
Save Geofferey/98ae520646fc8ff14485be53e2576b5a to your computer and use it in GitHub Desktop.
WIP Switch back to active
#!/bin/bash
## Use tasker + termux + ssh keys to run inside of waydroid and export WAYDROID_LAUNCH
PRIMARY_VT=1
WAYDROID_VT=7
PREV_VT=$(cat /tmp/.prev-vt)
CUR_VT=$(fgconsole)
if [[ ${CUR_VT} != ${WAYDROID_VT} ]]; then
echo ${CUR_VT} > /tmp/.prev-vt
# chmod 777 /tmp/.prev-vt
fi
if [[ ! -z ${PREV_VT} ]]; then
VT_CHK=$(loginctl |grep seat0 |grep -w "tty${PREV_VT}")
fi
if [[ ${CUR_VT} = ${PREV_VT} ]] && [[ ! -z ${WAYDROID_LAUNCH} ]]; then
exit 0
fi
if [[ $(fgconsole) = ${WAYDROID_VT} ]] && [[ ! -z ${PREV_VT} ]] && [[ ! -z ${VT_CHK} ]]; then
killall -SIGCONT xfce4-power-manager
sudo chvt ${PREV_VT}
#sudo waydroid shell input keyevent KEYCODE_POWER
elif [[ ${PREV_VT} != ${WAYDROID_VT} ]]; then
killall -SIGSTOP xfce4-power-manager
sudo waydroid shell input keyevent KEYCODE_VOLUME_DOWN
sudo chvt ${WAYDROID_VT}
else
#sudo chvt 1
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment