Implement default hooks for ringing and incoming texts, playing audio
This commit is contained in:
parent
2188ed15ea
commit
bec7106317
7 changed files with 68 additions and 0 deletions
8
configs/default_hooks/missed_call
Normal file
8
configs/default_hooks/missed_call
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# This script is executed (asynchronously) when you missed a call
|
||||||
|
# You can use it to play a ring tone
|
||||||
|
|
||||||
|
#we simply remove the ring trigger file
|
||||||
|
#written by the ring hook and the ringing will stop
|
||||||
|
rm /tmp/ring.trigger
|
9
configs/default_hooks/pickup
Normal file
9
configs/default_hooks/pickup
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# This script is executed (asynchronously) when you pick up an incoming call
|
||||||
|
|
||||||
|
# remove the ring trigger
|
||||||
|
rm /tmp/ring.trigger
|
||||||
|
|
||||||
|
# kill any existing playback
|
||||||
|
pkill mpv
|
20
configs/default_hooks/ring
Normal file
20
configs/default_hooks/ring
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# This script is executed (asynchronously) when you get an incoming call
|
||||||
|
# You can use it to play a ring tone
|
||||||
|
|
||||||
|
#we create a temporary trigger file /tmp/ring.trigger
|
||||||
|
#and ring for as long as it exists
|
||||||
|
#the missed_call or pickedup hooks delete
|
||||||
|
#delete this trigger again
|
||||||
|
touch /tmp/ring.trigger
|
||||||
|
i=0
|
||||||
|
while [ -f /tmp/ring.trigger ]; do
|
||||||
|
#play the ring over and over again as long as the trigger persists
|
||||||
|
mpv --quiet --no-video /usr/share/sxmo/ring.ogg
|
||||||
|
i=$((i+1))
|
||||||
|
if [ $i -gt 10 ]; then
|
||||||
|
#safety check to protect against runaway endless ringing
|
||||||
|
rm /tmp/ring.trigger
|
||||||
|
fi
|
||||||
|
done
|
10
configs/default_hooks/sms
Normal file
10
configs/default_hooks/sms
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# This script is executed after you received a text
|
||||||
|
#You can use it to play a notification sound or forward the sms elsewhere
|
||||||
|
|
||||||
|
#The following parameters are provided:
|
||||||
|
#CONTACTNAME="$1"
|
||||||
|
#TEXT="$2"
|
||||||
|
|
||||||
|
mpv --quiet --no-video /usr/share/sxmo/notify.ogg
|
BIN
resources/notify.ogg
Normal file
BIN
resources/notify.ogg
Normal file
Binary file not shown.
BIN
resources/ring.ogg
Normal file
BIN
resources/ring.ogg
Normal file
Binary file not shown.
|
@ -66,9 +66,30 @@ daemonsneedingdbus() {
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultconfig() {
|
defaultconfig() {
|
||||||
|
#this is only run on the very first start of sxmo
|
||||||
|
|
||||||
mkdir -p "$XDG_CONFIG_HOME/sxmo"
|
mkdir -p "$XDG_CONFIG_HOME/sxmo"
|
||||||
cp /usr/share/sxmo/appcfg/xinit_template "$XDG_CONFIG_HOME/sxmo/xinit"
|
cp /usr/share/sxmo/appcfg/xinit_template "$XDG_CONFIG_HOME/sxmo/xinit"
|
||||||
chmod u+rx "$XDG_CONFIG_HOME/sxmo/xinit"
|
chmod u+rx "$XDG_CONFIG_HOME/sxmo/xinit"
|
||||||
|
|
||||||
|
#Set some default hooks
|
||||||
|
mkdir -p "$XDG_CONFIG_HOME/sxmo/hooks"
|
||||||
|
if [ ! -e "$XDG_CONFIG_HOME/sxmo/hooks/ring" ]; then
|
||||||
|
cp /usr/share/sxmo/default_hooks/ring "$XDG_CONFIG_HOME/sxmo/hooks/ring"
|
||||||
|
chmod u+rx "$XDG_CONFIG_HOME/sxmo/hooks/ring"
|
||||||
|
fi
|
||||||
|
if [ ! -e "$XDG_CONFIG_HOME/sxmo/hooks/sms" ]; then
|
||||||
|
cp /usr/share/sxmo/default_hooks/sms "$XDG_CONFIG_HOME/sxmo/hooks/sms"
|
||||||
|
chmod u+rx "$XDG_CONFIG_HOME/sxmo/hooks/sms"
|
||||||
|
fi
|
||||||
|
if [ ! -e "$XDG_CONFIG_HOME/sxmo/hooks/pickup" ]; then
|
||||||
|
cp /usr/share/sxmo/default_hooks/pickup "$XDG_CONFIG_HOME/sxmo/hooks/pickup"
|
||||||
|
chmod u+rx "$XDG_CONFIG_HOME/sxmo/hooks/pickup"
|
||||||
|
fi
|
||||||
|
if [ ! -e "$XDG_CONFIG_HOME/sxmo/hooks/missed_call" ]; then
|
||||||
|
cp /usr/share/sxmo/default_hooks/missed_call "$XDG_CONFIG_HOME/sxmo/hooks/missed_call"
|
||||||
|
chmod u+rx "$XDG_CONFIG_HOME/sxmo/hooks/missed_call"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
customxinit() {
|
customxinit() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue