Add ringtones/wallpapers plugins, AT console, dialer USSD/*#06#, and SIM icon fix
This commit is contained in:
@@ -11,78 +11,86 @@
|
||||
# shellcheck source=scripts/core/sxmo_common.sh
|
||||
. sxmo_common.sh
|
||||
|
||||
if [ -f "$XDG_CONFIG_HOME/sxmo/ringsettings" ]; then
|
||||
# shellcheck disable=SC1091
|
||||
. "$XDG_CONFIG_HOME/sxmo/ringsettings"
|
||||
fi
|
||||
|
||||
if [ -f "$XDG_CONFIG_HOME/sxmo/ringtone" ]; then
|
||||
custom_ring="$(head -n 1 "$XDG_CONFIG_HOME/sxmo/ringtone" 2>/dev/null)"
|
||||
if [ -n "$custom_ring" ] && [ -f "$custom_ring" ]; then
|
||||
SXMO_RINGTONE="$custom_ring"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Only vibrate if you already got an active call
|
||||
if sxmo_modemcall.sh list_active_calls \
|
||||
| grep -v ringing-in \
|
||||
| grep -q .; then
|
||||
sxmo_vibrate 1500 "${SXMO_VIBRATE_STRENGTH:-1}"
|
||||
exit
|
||||
| grep -v ringing-in \
|
||||
| grep -q .; then
|
||||
sxmo_vibrate 1500 "${SXMO_VIBRATE_STRENGTH:-1}"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Shallow if you have more than one ringing call
|
||||
if ! sxmo_modemcall.sh list_active_calls \
|
||||
| grep -c ringing-in \
|
||||
| grep -q 1; then
|
||||
exit
|
||||
| grep -c ringing-in \
|
||||
| grep -q 1; then
|
||||
exit
|
||||
fi
|
||||
|
||||
finish() {
|
||||
trap - INT TERM EXIT
|
||||
jobs -p | xargs -r kill
|
||||
wait
|
||||
exit
|
||||
trap - INT TERM EXIT
|
||||
jobs -p | xargs -r kill
|
||||
wait
|
||||
exit
|
||||
}
|
||||
|
||||
ring() {
|
||||
mpv --no-resume-playback --quiet --no-video \
|
||||
--loop="${SXMO_RINGNUMBER:-10}" "$SXMO_RINGTONE" >/dev/null &
|
||||
mpv --no-resume-playback --quiet --no-video \
|
||||
--loop="${SXMO_RINGNUMBER:-10}" "$SXMO_RINGTONE" >/dev/null &
|
||||
}
|
||||
|
||||
vibrate() {
|
||||
while : ; do
|
||||
trap 'finish' INT TERM EXIT
|
||||
sxmo_vibrate 1500 "${SXMO_VIBRATE_STRENGTH:-1}" &
|
||||
wait "$!"
|
||||
while : ; do
|
||||
trap 'finish' INT TERM EXIT
|
||||
sxmo_vibrate 1500 "${SXMO_VIBRATE_STRENGTH:-1}" &
|
||||
wait "$!"
|
||||
|
||||
sleep 0.5 &
|
||||
wait "$!"
|
||||
done &
|
||||
sleep 0.5 &
|
||||
wait "$!"
|
||||
done &
|
||||
}
|
||||
|
||||
# SILENT MODE
|
||||
if [ -f "$XDG_CONFIG_HOME"/sxmo/.busy ]; then
|
||||
end="$(cat "$XDG_CONFIG_HOME"/sxmo/.busy)"
|
||||
if [ -z "$end" ] || [ "$(date +%s)" -lt "$end" ]; then
|
||||
exit
|
||||
fi
|
||||
end="$(cat "$XDG_CONFIG_HOME"/sxmo/.busy)"
|
||||
if [ -z "$end" ] || [ "$(date +%s)" -lt "$end" ]; then
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
# RING & VIBRATE MODE (DEFAULT)
|
||||
if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.noring ] && [ ! -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ]; then
|
||||
sxmo_log "RING AND VIBRATE"
|
||||
sxmo_log "RING AND VIBRATE"
|
||||
|
||||
# In order for this to work, you will need to install playerctl and run playerctld
|
||||
# In order for this to work with mpv, you will need to install mpv-mdis.
|
||||
sxmo_playerctl.sh pause_all
|
||||
sxmo_playerctl.sh pause_all
|
||||
|
||||
ring
|
||||
vibrate
|
||||
ring
|
||||
vibrate
|
||||
|
||||
# RING-ONLY MODE
|
||||
elif [ ! -f "$XDG_CONFIG_HOME"/sxmo/.noring ] && [ -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ]; then
|
||||
sxmo_log "RING ONLY"
|
||||
sxmo_log "RING ONLY"
|
||||
|
||||
# In order for this to work, you will need to install playerctl and run playerctld
|
||||
# In order for this to work with mpv, you will need to install mpv-mdis.
|
||||
sxmo_playerctl.sh pause_all
|
||||
sxmo_playerctl.sh pause_all
|
||||
|
||||
ring
|
||||
ring
|
||||
|
||||
# VIBRATE-ONLY MODE
|
||||
elif [ ! -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ] && [ -f "$XDG_CONFIG_HOME"/sxmo/.noring ]; then
|
||||
smxo_log "VIBRATE ONLY"
|
||||
sxmo_log "VIBRATE ONLY"
|
||||
|
||||
vibrate
|
||||
vibrate
|
||||
fi
|
||||
|
||||
trap 'finish' INT TERM EXIT
|
||||
|
||||
Reference in New Issue
Block a user