01-27-2021, 09:38 PM
Hook-seller! I need your STRONGEST hooks and userscripts!
I'll start.
Surf gesture so that back and enter go back and forward in history.
Ring hook that checks if the number is a contact. If so, it will ring, if not, it won't! This cuts down on being annoyed by robo-callers. It also checks if the file $HOME/.config/sxmo/silent exists. If so, it won't ring. I stole the main bits of the ring/pickup scripts from someone here (if it's you, sound off and thanks!) but added the contact/silent checking.
I'm not the greatest shell scripter, but with just a little bit here and there, sxmo gets comfier and comfier. It is now "legs go numb on the toilet while looking at memes on the pinephone" worthy. I'm also looking for some apps hook examples if you got 'em! I can't seem to make mine work without breaking something.
I'll start.
Surf gesture so that back and enter go back and forward in history.
Code:
#!/bin/sh
# $HOME/.config/sxmo/hooks/gesture
case $1 in
"surf")
if [ $2 = "back" ]; then
xdotool key ctrl+h & exit 0
elif [ $2 = "enter" ]; then
xdotool key ctrl+l & exit 0
else
exit 1
fi
;;
*) exit 1
esac
Ring hook that checks if the number is a contact. If so, it will ring, if not, it won't! This cuts down on being annoyed by robo-callers. It also checks if the file $HOME/.config/sxmo/silent exists. If so, it won't ring. I stole the main bits of the ring/pickup scripts from someone here (if it's you, sound off and thanks!) but added the contact/silent checking.
Code:
#!/usr/bin/env sh
# $HOME/.config/sxmo/hooks/ring
NUMBER="$1"
CONTACT=$(sxmo_contacts.sh --all |
grep "$NUMBER"
)
SILENT=$HOME/.config/sxmo/silent
incallmonitor() {
CALLRINGING=$(mmcli -m "$(modem_n)" --voice-list-calls)
echo $CALLRINGING
if [[ "$CALLRINGING" == "No calls were found" ]]; then
exit 1
fi
}
modem_n() {
MODEMS="$(mmcli -L)"
echo "$MODEMS" | grep -qoE 'Modem\/([0-9]+)' || finish "Couldn't find modem - is your modem enabled?"
echo "$MODEMS" | grep -oE 'Modem\/([0-9]+)' | cut -d'/' -f2
}
if [ -n "$CONTACT" ]; then
sxmo_audioout.sh Speaker
amixer sset 'Line Out' 100%
if [ ! -f $SILENT ]; then
mpv --no-resume-playback /home/mo/Music/char.opus
fi
while true; do
sxmo_vibratepine 1000
notify-send $1
incallmonitor "$1"
done
else
while true; do
notify-send $1
incallmonitor "$1"
done
fi
Code:
#!/bin/sh
# $HOME/.config/sxmo/hooks/pickup
ID=$(ps -ef|grep ring|grep -v grep|perl -ne '$_=~ m/^ *(.*) mo.*/;print $1')
kill -9 $ID
pkill mpv
sxmo_audioout.sh
Code:
#!/usr/bin/env sh
# $HOME/.config/sxmo/userscripts/silent
SILENT=$HOME/.config/sxmo/silent
if [ -e $SILENT ]; then
rm $SILENT && notify-send "Not Silent"
else
touch $SILENT && notify-send "Silent"
fi
I'm not the greatest shell scripter, but with just a little bit here and there, sxmo gets comfier and comfier. It is now "legs go numb on the toilet while looking at memes on the pinephone" worthy. I'm also looking for some apps hook examples if you got 'em! I can't seem to make mine work without breaking something.