~mil/sxmo-utils

93c5bb46a5d9c927261ebb7a228c45d4d0b7fb26 — Maarten van Gompel 4 months ago ef02db4 newlock
Make newlock adhere to old env variables
2 files changed, 23 insertions(+), 9 deletions(-)

M scripts/core/sxmo_inputhandler.sh
M scripts/core/sxmo_screenlock.sh
M scripts/core/sxmo_inputhandler.sh => scripts/core/sxmo_inputhandler.sh +23 -4
@@ 9,16 9,35 @@ ACTION="$1"
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"

crust() {
	if [ -n "$SXMO_RTCWAKEINTERVAL" ]; then
		sxmo_screenlock.sh rtc "$SXMO_RTCWAKEINTERVAL"
	else
		sxmo_screenlock.sh crust
	fi
}

lock_screen() {
	if [ "$SXMO_LOCK_SCREEN_OFF" = "1" ]; then
		sxmo_screenlock.sh off
	else
		sxmo_screenlock.sh lock
	fi
	if [ "$SXMO_LOCK_SUSPEND" = "1" ]; then
		crust
	fi
}

if [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; then
	case "$ACTION" in
		"volup_three")
			sxmo_screenlock.sh crust
			crust
			;;
		"voldown_three")
			if [ "$(sxmo_screenlock.sh getCurState)" = "lock" ]; then
				sxmo_screenlock.sh off
			else
				sxmo_screenlock.sh lock
				lock_screen
			fi
			;;
		"powerbutton_three")


@@ 172,7 191,7 @@ if [ "$HANDLE" -ne 0 ]; then
			sxmo_appmenu.sh sys
			;;
		"volup_three")
			sxmo_screenlock.sh lock
			lock_screen
			;;
		"voldown_one")
			xdotool key --clearmodifiers Super+space


@@ 193,7 212,7 @@ if [ "$HANDLE" -ne 0 ]; then
			sxmo_appmenu.sh scripts &
			;;
		"bottomleftcorner")
			sxmo_screenlock.sh lock
			lock_screen
			;;
		"bottomrightcorner")
			sxmo_rotate.sh &

M scripts/core/sxmo_screenlock.sh => scripts/core/sxmo_screenlock.sh +0 -5
@@ 63,11 63,6 @@ updateLed() {
	esac
}

if [ "$1" = "crust" ] && [ -n "$SXMO_RTCWAKEINTERVAL" ]; then
	shift
	set -- rtc "$SXMO_RTCWAKEINTERVAL" "$@"
fi

if [ "$1" = "lock" ] ; then
	# always echo last state first so that user can use it in their hooks
	# TODO: Document LASTSTATE