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

@ -171,7 +171,7 @@ incallmenuloop() {
echo "sxmo_modemcall: Current flags are $FLAGS">&2
CHOICES="
$([ "$WINDOWIFIED" = 0 ] && echo "$icon_wn2 Windowify" || echo "$icon_wn2 Unwindowify") ^ togglewindowify
$([ "$WINDOWIFIED" = 0 ] && echo "$icon_lck Screenlock ^ togglewindowify; sxmo_screenlock &")
$([ "$WINDOWIFIED" = 0 ] && echo "$icon_lck Screenlock ^ togglewindowify; sxmo_screenlock.sh lock &")
$icon_aru Volume up ^ sxmo_vol.sh up
$icon_ard Volume down ^ sxmo_vol.sh down
$icon_phn Earpiece $(echo -- "$FLAGS" | grep -q -- -e && echo "$icon_chk") ^ toggleflagset -e
@ -239,8 +239,6 @@ incomingcallmenu() {
NUMBER=$(vid_to_number "$1")
CONTACTNAME=$(number_to_contactname "$NUMBER")
# wait for sxmo to be unlocked to display menus
while pgrep sxmo_screenlock > /dev/null; do sleep 0.3; done
PICKED="$(
printf %b "$icon_phn Pickup\n$icon_phx Hangup\n$icon_mut Mute\n" |
dmenu -c -l 5 -p "$CONTACTNAME"

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() {