Rework the sxmo screenlock

This commit is contained in:
Anjandev Momi 2021-04-30 20:34:19 -04:00 committed by Stacy Harper
parent 7fbc1d347a
commit 725d89d6d6
No known key found for this signature in database
GPG key ID: 5BAC92328B7C5D65
12 changed files with 352 additions and 604 deletions

View file

@ -116,6 +116,13 @@ checkforfinishedcalls() {
"st -f Terminus-20 -e sh -c \"echo 'Missed call from $CONTACT at $(date)' && read\"" \
none \
"Missed call - $CONTACT"
if grep -q modem "$UNSUSPENDREASONFILE" && grep -q crust "$CACHEDIR/${FINISHEDCALLID}.laststate"; then
sleep 5 # maybe user just is too late
if [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; then
sxmo_screenlock.sh crust
fi
fi
fi
done
}
@ -131,11 +138,15 @@ checkforincomingcalls() {
[ -f "$CACHEDIR/${VOICECALLID}.monitoredcall" ] && return # prevent multiple rings
touch "$CACHEDIR/${VOICECALLID}.monitoredcall" #this signals that we handled the call
cat "$LASTSTATE" > "$CACHEDIR/${VOICECALLID}.laststate"
# Determine the incoming phone number
echo "sxmo_modemmonitor: Incoming Call:">&2
INCOMINGNUMBER=$(lookupnumberfromcallid "$VOICECALLID")
CONTACTNAME=$(lookupcontactname "$INCOMINGNUMBER")
xset dpms force on
if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/ring" ]; then
echo "sxmo_modemmonitor: Invoking ring hook (async)">&2
"$XDG_CONFIG_HOME/sxmo/hooks/ring" "$CONTACTNAME" &
@ -160,6 +171,8 @@ checkfornewtexts() {
)"
echo "$TEXTIDS" | grep -v . && return
xset dpms force on
# Loop each textid received and read out the data into appropriate logfile
for TEXTID in $TEXTIDS; do
TEXTDATA="$(mmcli -m "$(modem_n)" -s "$TEXTID" -K)"
@ -188,6 +201,13 @@ checkfornewtexts() {
"$XDG_CONFIG_HOME/sxmo/hooks/sms" "$CONTACTNAME" "$TEXT"
fi
done
if grep -q modem "$UNSUSPENDREASONFILE" && grep -q crust "$LASTSTATE"; then
sleep 5 # maybe user just is too late
if [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; then
sxmo_screenlock.sh crust
fi
fi
}
initialmodemstatus() {