Make sxmo hooks scripts in PATH

We then add /usr/share/sxmo/default_hooks/ to the PATH (see
sxmo_init.sh)
This commit is contained in:
Stacy Harper
2022-02-10 13:01:40 +01:00
parent f63acf5a55
commit 92c258f990
48 changed files with 88 additions and 96 deletions

View File

@@ -208,4 +208,4 @@ exec 'printf %s "$SWAYSOCK" > "$XDG_RUNTIME_DIR"/sxmo.swaysock'
output * bg /usr/share/sxmo/background.jpg fill
exec sxmo_hooks.sh start
exec sxmo_hook_start.sh

View File

@@ -3,4 +3,4 @@
# Run actions on start
# By default, setup audio over the main speaker
# and set a sane default volume
sxmo_hooks.sh start &
sxmo_hook_start.sh &

View File

@@ -21,12 +21,12 @@ fi
case "$WMCLASS" in
scripts)
# Scripts menu
CHOICES="$(sxmo_hooks.sh scripts)"
CHOICES="$(sxmo_hook_scripts.sh)"
WINNAME=Scripts
;;
applications)
# Apps menu
CHOICES="$(sxmo_hooks.sh apps)"
CHOICES="$(sxmo_hook_apps.sh)"
WINNAME=Apps
;;
modem)
@@ -36,11 +36,11 @@ case "$WMCLASS" in
$icon_phn Modem Monitor $(
sxmo_daemons.sh running modem_monitor -q &&
printf %b "$icon_ton ^ 1 ^ sxmo_daemons.sh stop modem_monitor" || printf %b "$icon_tof ^ 1 ^ sxmo_daemons.sh start modem_monitor sxmo_modemmonitor.sh"
) && sxmo_hooks.sh statusbar modem_monitor
) && sxmo_hook_statusbar.sh modem_monitor
$icon_phn Modem Daemons $(
sxmo_modemdaemons.sh status > /dev/null &&
printf %b "$icon_ton ^ 1 ^ sxmo_modemdaemons.sh stop" || printf %b "$icon_tof ^ 1 ^ sxmo_modemdaemons.sh start"
) && sxmo_hooks.sh statusbar modem
) && sxmo_hook_statusbar.sh modem
$icon_inf Modem Info ^ 0 ^ sxmo_modeminfo.sh
$icon_phl Modem Log ^ 0 ^ sxmo_modemlog.sh
$icon_img Config MMS ^ 1 ^ sxmo_mmsdconfig.sh
@@ -66,17 +66,17 @@ case "$WMCLASS" in
$icon_cfg Gestures $(
sxmo_daemons.sh running lisgd -q &&
printf "%s" "$icon_ton" || printf "%s" "$icon_tof"
) ^ 1 ^ toggle_daemon 'Lisgd' lisgd sxmo_hooks.sh lisgdstart
) ^ 1 ^ toggle_daemon 'Lisgd' lisgd sxmo_hook_lisgdstart.sh
$icon_cfg Toggle Bar ^ 0 ^ sxmo_wm.sh togglebar
$icon_bth Bluetooth $(
rfkill list bluetooth | grep -q "yes" &&
printf %b "$icon_tof" || printf %b "$icon_ton";
printf %b "^ 1 ^ doas sxmo_bluetoothtoggle.sh && sxmo_hooks.sh statusbar bluetooth"
printf %b "^ 1 ^ doas sxmo_bluetoothtoggle.sh && sxmo_hook_statusbar.sh bluetooth"
)
$icon_wif Wifi $(
rfkill -rn | grep wlan | grep -qE "unblocked unblocked" &&
printf %b "$icon_ton" || printf %b "$icon_tof";
printf %b "^ 1 ^ doas sxmo_wifitoggle.sh && sxmo_hooks.sh statusbar wifi"
printf %b "^ 1 ^ doas sxmo_wifitoggle.sh && sxmo_hook_statusbar.sh wifi"
)
$(test "$SXMO_WM" = dwm && printf %b "$icon_cfg Invert Colors ^ 1 ^ xcalib -a -invert")
$icon_clk Change Timezone ^ 1 ^ sxmo_timezonechange.sh
@@ -107,9 +107,9 @@ case "$WMCLASS" in
power)
# Power menu
CHOICES="
$icon_lck Lock ^ 0 ^ sxmo_hooks.sh lock
$icon_lck Lock (Screen off) ^ 0 ^ sxmo_hooks.sh screenoff
$icon_zzz Suspend ^ 0 ^ sxmo_hooks.sh screenoff && sxmo_hooks.sh crust
$icon_lck Lock ^ 0 ^ sxmo_hook_lock.sh
$icon_lck Lock (Screen off) ^ 0 ^ sxmo_hook_screenoff.sh
$icon_zzz Suspend ^ 0 ^ sxmo_hook_screenoff.sh && sxmo_hook_crust.sh
$icon_out Logout ^ 0 ^ confirm Logout && (pkill -9 dwm || pkill -9 sway)
$icon_rol Toggle WM ^ 0 ^ confirm Toggle && sxmo_wmtoggle.sh
$icon_rld Reboot ^ 0 ^ confirm Reboot && sxmo_power.sh reboot

View File

@@ -3,4 +3,4 @@
# This script is executed (asynchronously) when you discard an incoming call
# just do the same as the missed_call hook:
exec sxmo_hooks.sh missed_call "$@"
exec sxmo_hook_missed_call.sh "$@"

View File

@@ -18,15 +18,15 @@ if [ -n "$SXMO_STYLUS_ID" ] || [ -n "$SXMO_TOUCHSCREEN_ID" ]; then
sxmo_daemons.sh stop lisgd
fi
sxmo_hooks.sh statusbar state_change
sxmo_hooks.sh statusbar locked
sxmo_hook_statusbar.sh state_change
sxmo_hook_statusbar.sh locked
wait "$LEDPID"
# Go to screenoff after 8 seconds of inactivity
if ! [ -e "$XDG_CACHE_HOME/sxmo/sxmo.noidle" ]; then
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
timeout 8 "sxmo_hooks.sh screenoff"
timeout 8 "sxmo_hook_screenoff.sh"
fi
sxmo_daemons.sh signal desktop_widget -12

View File

@@ -3,4 +3,4 @@
# This script is executed (asynchronously) when you mute an incoming call
# just do the same as the missed_call hook:
exec sxmo_hooks.sh missed_call "$@"
exec sxmo_hook_missed_call.sh "$@"

View File

@@ -11,7 +11,7 @@ if [ "$UNSUSPENDREASON" != "modem" ]; then
echo 1200 > "$NETWORKRTCSCAN"
fi
sxmo_hooks.sh statusbar time
sxmo_hook_statusbar.sh time
if grep -q rtc "$SXMO_UNSUSPENDREASONFILE"; then
# We stopped it in presuspend

View File

@@ -19,7 +19,7 @@ if [ -n "$SXMO_TOUCHSCREEN_ID" ] || [ -n "$SXMO_STYLUS_ID" ]; then
sxmo_daemons.sh stop lisgd
fi
sxmo_hooks.sh statusbar locked
sxmo_hook_statusbar.sh locked
wait "$LEDPID"
@@ -36,16 +36,16 @@ esac
# Resume tasks stop daemons
if [ -z "$SXMO_DISABLE_LEDS" ]; then
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
timeout 8 'sxmo_daemons.sh start going_deeper sxmo_run_periodically.sh 5 sh -c "sxmo_hooks.sh check_state_mutexes && exec sxmo_mutex.sh can_suspend holdexec sxmo_suspend.sh"' \
timeout 8 'sxmo_daemons.sh start going_deeper sxmo_run_periodically.sh 5 sh -c "sxmo_hook_check_state_mutexes.sh && exec sxmo_mutex.sh can_suspend holdexec sxmo_suspend.sh"' \
resume 'sxmo_daemons.sh stop going_deeper' \
timeout 5 'sxmo_daemons.sh start periodic_blink sxmo_run_periodically.sh 2 sxmo_led.sh blink red blue' \
resume 'sxmo_daemons.sh stop periodic_blink' \
timeout 12 'sxmo_daemons.sh start periodic_state_mutex_check sxmo_run_periodically.sh 10 sxmo_hooks.sh check_state_mutexes' \
timeout 12 'sxmo_daemons.sh start periodic_state_mutex_check sxmo_run_periodically.sh 10 sxmo_hook_check_state_mutexes.sh' \
resume 'sxmo_daemons.sh stop periodic_state_mutex_check'
else
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
timeout 8 'sxmo_daemons.sh start going_deeper sh -c "sxmo_hooks.sh check_state_mutexes && exec sxmo_mutex.sh can_suspend holdexec sxmo_suspend.sh"' \
timeout 8 'sxmo_daemons.sh start going_deeper sh -c "sxmo_hook_check_state_mutexes.sh && exec sxmo_mutex.sh can_suspend holdexec sxmo_suspend.sh"' \
resume 'sxmo_daemons.sh stop going_deeper' \
timeout 12 'sxmo_daemons.sh start periodic_state_mutex_check sxmo_run_periodically.sh 10 sxmo_hooks.sh check_state_mutexes' \
timeout 12 'sxmo_daemons.sh start periodic_state_mutex_check sxmo_run_periodically.sh 10 sxmo_hook_check_state_mutexes.sh' \
resume 'sxmo_daemons.sh stop periodic_state_mutex_check'
fi

View File

@@ -52,12 +52,12 @@ if [ -f "${SXMO_VVM_BASE_DIR:-"$HOME"/.vvm/modemmanager}/vvm" ]; then
fi
# Start the desktop widget (e.g. clock)
sxmo_daemons.sh start desktop_widget sxmo_hooks.sh desktop_widget
sxmo_daemons.sh start desktop_widget sxmo_hook_desktop_widget.sh
# Periodically update some status bar components
sxmo_hooks.sh statusbar all
sxmo_hook_statusbar.sh all
sxmo_daemons.sh start statusbar_periodics sxmo_run_periodically.sh 55 \
sxmo_hooks.sh statusbar periodics
sxmo_hook_statusbar.sh periodics
# Monitor the battery
sxmo_daemons.sh start battery_monitor sxmo_battery_monitor.sh
@@ -69,7 +69,7 @@ sxmo_daemons.sh start network_monitor sxmo_networkmonitor.sh
sxmo_daemons.sh start notification_monitor sxmo_notificationmonitor.sh
# To setup initial lock state
sxmo_hooks.sh unlock
sxmo_hook_unlock.sh
sxmo_daemons.sh start pipewire pipewire

View File

@@ -17,11 +17,11 @@ sxmo_wm.sh dpms off
[ -z "$SXMO_STYLUS_ID" ] || sxmo_wm.sh inputevent stylus on
if [ -n "$SXMO_TOUCHSCREEN_ID" ] || [ -n "$SXMO_TOUCHSCREEN_ID" ]; then
sxmo_hooks.sh lisgdstart
sxmo_hook_lisgdstart.sh
fi
sxmo_hooks.sh statusbar state_change
sxmo_hooks.sh statusbar locked
sxmo_hook_statusbar.sh state_change
sxmo_hook_statusbar.sh locked
wait "$LEDPID"
@@ -31,7 +31,7 @@ echo 16000 > "$NETWORKRTCSCAN"
# Go to lock after 120 seconds of inactivity
if ! [ -e "$XDG_CACHE_HOME/sxmo/sxmo.noidle" ]; then
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
timeout "${SXMO_UNLOCK_IDLE_TIME:-120}" "sxmo_hooks.sh lock"
timeout "${SXMO_UNLOCK_IDLE_TIME:-120}" "sxmo_hook_lock.sh"
fi
sxmo_daemons.sh signal desktop_widget -12

View File

@@ -64,6 +64,8 @@ _sxmo_load_environments() {
command -v "$EDITOR" >/dev/null || export EDITOR=vim
command -v "$SHELL" >/dev/null || export SHELL=/bin/sh
export PATH="$XDG_CONFIG_HOME/sxmo/hooks/:/usr/share/sxmo/default_hooks/:$PATH"
if [ -e /sys/firmware/devicetree/base/compatible ]; then
device="$(cut -d ',' -f 2 < /sys/firmware/devicetree/base/compatible | tr -d '\0')"
deviceprofile="$(which "sxmo_deviceprofile_$device.sh")"

View File

@@ -34,7 +34,7 @@ sxmo_type() {
}
getprogchoices() {
RES="$(sxmo_hooks.sh contextmenu "$1")"
RES="$(sxmo_hook_contextmenu.sh "$1")"
if [ -n "$RES" ]; then
WINNAME="$(printf %s "$RES" | head -n1)"
CHOICES="$(printf %s "$RES" | tail -n+2)"

View File

@@ -25,7 +25,7 @@ notifyvol() {
dunstify -r 999 "♫ Volume $vol"
;;
esac
sxmo_hooks.sh statusbar volume
sxmo_hook_statusbar.sh volume
}
pulsevolup() {
@@ -141,7 +141,7 @@ alsadeviceset() {
fi
printf '%s' "$DEV" > "$XDG_RUNTIME_DIR/sxmo.audiocurrentdevice"
sxmo_hooks.sh statusbar volume
sxmo_hook_statusbar.sh volume
}
alsamenuchoices() {

View File

@@ -4,7 +4,7 @@ udev_tmp="$(mktemp)"
udevadm monitor -u -s power_supply >> "$udev_tmp" &
UDEVPID=$!
tail -f "$udev_tmp" | while read -r; do
sxmo_hooks.sh statusbar battery
sxmo_hook_statusbar.sh battery
done &
STATUSBATTERYPID=$!

View File

@@ -1,10 +0,0 @@
#!/bin/sh
hook="$1"
shift
if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/$hook" ]; then
exec "$XDG_CONFIG_HOME/sxmo/hooks/$hook" "$@"
elif [ -x "/usr/share/sxmo/default_hooks/$hook" ]; then
exec "/usr/share/sxmo/default_hooks/$hook" "$@"
fi

View File

@@ -29,7 +29,7 @@ lock_screen_action() {
count=$((count-1))
done
sxmo_hooks.sh "$state"
sxmo_hook_"$state".sh
}
XPROPOUT="$(sxmo_wm.sh focusedwindow)"
@@ -333,9 +333,9 @@ case "$ACTION" in
"bottomleftcorner")
sxmo_dmenu.sh close
if [ -n "$WMCLASS" ]; then
sxmo_hooks.sh lock
sxmo_hook_lock.sh
else
sxmo_hooks.sh screenoff
sxmo_hook_screenoff.sh
fi
exit 0
;;

View File

@@ -9,7 +9,7 @@ stderr() {
}
gracefulexit() {
sxmo_hooks.sh statusbar wifi
sxmo_hook_statusbar.sh wifi
stderr "gracefully exiting (on signal or after error)"
sxmo_daemons.sh stop network_monitor_device
exit
@@ -42,23 +42,23 @@ sxmo_daemons.sh start network_monitor_device \
if echo "$newstate" | grep -q "uint32 100"; then
# 100=NM_DEVICE_STATE_ACTIVATED
stderr "$devicename up."
sxmo_hooks.sh network-up "$devicename"
sxmo_hooks.sh statusbar "network_$devicename"
sxmo_hook_network_up.sh "$devicename"
sxmo_hook_statusbar.sh "network_$devicename"
elif echo "$newstate" | grep -q "uint32 30"; then
# 30=NM_DEVICE_STATE_DISCONNECTED
stderr "$devicename down."
sxmo_hooks.sh network-down "$devicename"
sxmo_hooks.sh statusbar "network_$devicename"
sxmo_hook_network_down.sh "$devicename"
sxmo_hook_statusbar.sh "network_$devicename"
elif echo "$newstate" | grep -q "uint32 110"; then
# 110=NM_DEVICE_STATE_DEACTIVATING
stderr "$devicename pre-down"
sxmo_hooks.sh network-pre-down "$devicename"
sxmo_hooks.sh statusbar "network_$devicename"
sxmo_hook_network_pre_down.sh "$devicename"
sxmo_hook_statusbar.sh "network_$devicename"
elif echo "$newstate" | grep -q "uint32 90"; then
# 90=NM_DEVICE_STATE_SECONDARIES
stderr "$devicename pre-up"
sxmo_hooks.sh network-pre-up "$devicename"
sxmo_hooks.sh statusbar "network_$devicename"
sxmo_hook_network_pre_up.sh "$devicename"
sxmo_hook_statusbar.sh "network_$devicename"
fi
fi
done

View File

@@ -6,12 +6,12 @@ usage() {
case "$1" in
reboot)
sxmo_hooks.sh reboot
sxmo_hook_reboot.sh
sxmo_daemons.sh stop all
doas reboot
;;
poweroff)
sxmo_hooks.sh poweroff
sxmo_hook_poweroff.sh
sxmo_daemons.sh stop all
doas poweroff
;;

View File

@@ -6,7 +6,7 @@ isLocked() {
finish() {
sxmo_mutex.sh can_suspend free "Proximity lock is running"
sxmo_hooks.sh "$INITIALSTATE"
sxmo_hook_"$INITIALSTATE".sh
exit 0
}
@@ -26,9 +26,9 @@ mainloop() {
while true; do
distance="$(distance)"
if isLocked && [ "$distance" -lt "$TARGET" ]; then
sxmo_hooks.sh unlock
sxmo_hook_unlock.sh
elif ! isLocked && [ "$distance" -gt "$TARGET" ]; then
sxmo_hooks.sh screenoff
sxmo_hook_screenoff.sh
fi
sleep 0.5
done

View File

@@ -46,7 +46,7 @@ xorgrotnormal() {
sxmo_keyboard.sh close
xrandr -o normal
applyptrmatrix 0 0 0 0 0 0 0 0 0
sxmo_hooks.sh lisgdstart &
sxmo_hook_lisgdstart.sh &
exit 0
}
@@ -54,7 +54,7 @@ swayrotnormal() {
swaymsg -- output "$monitor" transform 0
swaymsg -- input type:touch map_to_output "$monitor"
swaymsg -- input type:tablet_tool map_to_output "$monitor"
sxmo_hooks.sh lisgdstart &
sxmo_hook_lisgdstart.sh &
exit 0
}
@@ -62,7 +62,7 @@ xorgrotright() {
sxmo_keyboard.sh close
xrandr -o right
applyptrmatrix 0 1 0 -1 0 1 0 0 1
sxmo_hooks.sh lisgdstart &
sxmo_hook_lisgdstart.sh &
exit 0
}
@@ -70,7 +70,7 @@ swayrotright() {
swaymsg -- output "$monitor" transform 90
swaymsg -- input type:touch map_to_output "$monitor"
swaymsg -- input type:tablet_tool map_to_output "$monitor"
sxmo_hooks.sh lisgdstart &
sxmo_hook_lisgdstart.sh &
exit 0
}
@@ -78,7 +78,7 @@ xorgrotleft() {
sxmo_keyboard.sh close
xrandr -o left
applyptrmatrix 0 -1 1 1 0 0 0 0 1
sxmo_hooks.sh lisgdstart &
sxmo_hook_lisgdstart.sh &
exit 0
}
@@ -86,7 +86,7 @@ swayrotleft() {
swaymsg -- output "$monitor" transform 270
swaymsg -- input type:touch map_to_output "$monitor"
swaymsg -- input type:tablet_tool map_to_output "$monitor"
sxmo_hooks.sh lisgdstart &
sxmo_hook_lisgdstart.sh &
exit 0
}

View File

@@ -44,10 +44,10 @@ sxmo_log "going to suspend to crust"
saveAllEventCounts
sxmo_hooks.sh presuspend
sxmo_hook_presuspend.sh
YEARS8_TO_SEC=268435455
if mnc="$(sxmo_hooks.sh mnc)"; then
if mnc="$(sxmo_hook_mnc.sh)"; then
#wake up 10 seconds before the next cron event
suspend_time="$((mnc-10))"
fi
@@ -74,4 +74,4 @@ if [ "$UNSUSPENDREASON" = "rtc" ]; then
sxmo_mutex.sh can_suspend lock "Waiting for cronjob"
fi
sxmo_hooks.sh postwake "$UNSUSPENDREASON"
sxmo_hook_postwake.sh "$UNSUSPENDREASON"

View File

@@ -8,7 +8,7 @@ change_alpine() {
echo "Changing timezone to $1"
doas setup-timezone -z "$1"
sxmo_hooks.sh statusbar time
sxmo_hook_statusbar.sh time
echo "Timezone changed ok"
}
@@ -17,7 +17,7 @@ change_arch() {
echo "Changing timezone to $1"
timedatectl set-timezone "$1"
sxmo_hooks.sh statusbar time
sxmo_hook_statusbar.sh time
echo "Timezone changed ok"
}

View File

@@ -46,7 +46,7 @@ init() {
start
cleanup
sxmo_hooks.sh stop
sxmo_hook_stop.sh
}
if [ -z "$1" ]; then

View File

@@ -68,7 +68,7 @@ init() {
start
cleanup
sxmo_hooks.sh stop
sxmo_hook_stop.sh
}
if [ -z "$1" ]; then

View File

@@ -250,9 +250,9 @@ processmms() {
if [ "$count" -gt 0 ]; then
GROUPNAME="$(sxmo_contacts.sh --name "$LOGDIRNUM")"
[ "$GROUPNAME" = "???" ] && GROUPNAME="$LOGDIRNUM"
sxmo_hooks.sh sms "$FROM_NAME" "$TEXT" "$MMS_FILE" "$GROUPNAME"
sxmo_hook_sms.sh "$FROM_NAME" "$TEXT" "$MMS_FILE" "$GROUPNAME"
else
sxmo_hooks.sh sms "$FROM_NAME" "$TEXT" "$MMS_FILE"
sxmo_hook_sms.sh "$FROM_NAME" "$TEXT" "$MMS_FILE"
fi
fi

View File

@@ -57,7 +57,7 @@ checkforfinishedcalls() {
elif [ -f "$XDG_RUNTIME_DIR/${FINISHEDCALLID}.pickedupcall" ]; then
#this call was picked up
pkill -f sxmo_modemcall.sh
sxmo_hooks.sh statusbar volume
sxmo_hook_statusbar.sh volume
stderr "Finished call from $FINISHEDNUMBER"
printf %b "$TIME\tcall_finished\t$FINISHEDNUMBER\n" >> "$SXMO_LOGDIR/modemlog.tsv"
elif [ -f "$XDG_RUNTIME_DIR/${FINISHEDCALLID}.hangedupcall" ]; then
@@ -67,7 +67,7 @@ checkforfinishedcalls() {
elif [ -f "$XDG_RUNTIME_DIR/${FINISHEDCALLID}.initiatedcall" ]; then
#this call was hung up by the contact
pkill -f sxmo_modemcall.sh
sxmo_hooks.sh statusbar volume
sxmo_hook_statusbar.sh volume
stderr "Finished call from $FINISHEDNUMBER"
printf %b "$TIME\tcall_finished\t$FINISHEDNUMBER\n" >> "$SXMO_LOGDIR/modemlog.tsv"
elif [ -f "$XDG_RUNTIME_DIR/${FINISHEDCALLID}.mutedring" ]; then
@@ -78,14 +78,14 @@ checkforfinishedcalls() {
#this is a missed call
# Add a notification for every missed call
pkill -f sxmo_modemcall.sh
sxmo_hooks.sh statusbar volume
sxmo_hook_statusbar.sh volume
stderr "Missed call from $FINISHEDNUMBER"
printf %b "$TIME\tcall_missed\t$FINISHEDNUMBER\n" >> "$SXMO_LOGDIR/modemlog.tsv"
CONTACT="$(sxmo_contacts.sh --name "$FINISHEDNUMBER")"
stderr "Invoking missed call hook (async)"
[ "$CONTACT" = "???" ] && CONTACT="$FINISHEDNUMBER"
sxmo_hooks.sh missed_call "$CONTACT" &
sxmo_hook_missed_call.sh "$CONTACT" &
sxmo_notificationwrite.sh \
random \
@@ -123,7 +123,7 @@ checkforincomingcalls() {
else
stderr "Invoking ring hook (async)"
[ "$CONTACTNAME" = "???" ] && CONTACTNAME="$INCOMINGNUMBER"
sxmo_hooks.sh ring "$CONTACTNAME" &
sxmo_hook_ring.sh "$CONTACTNAME" &
mkdir -p "$SXMO_LOGDIR"
printf %b "$TIME\tcall_ring\t$INCOMINGNUMBER\n" >> "$SXMO_LOGDIR/modemlog.tsv"
@@ -247,7 +247,7 @@ checkfornewtexts() {
"$SXMO_LOGDIR/$NUM/sms.txt" \
"$CONTACTNAME: $TEXT"
sxmo_hooks.sh sms "$CONTACTNAME" "$TEXT"
sxmo_hook_sms.sh "$CONTACTNAME" "$TEXT"
done
}

View File

@@ -18,7 +18,7 @@ stderr() {
finish() {
sxmo_vibrate 1000 &
setsid -f sh -c 'sleep 2; sxmo_hooks.sh statusbar call_duration'
setsid -f sh -c 'sleep 2; sxmo_hook_statusbar.sh call_duration'
if [ -n "$1" ]; then
stderr "$1"
notify-send Call "$1"
@@ -79,7 +79,7 @@ acceptcall() {
;;
incoming)
stderr "Invoking pickup hook (async)"
sxmo_hooks.sh pickup &
sxmo_hook_pickup.sh &
touch "$XDG_RUNTIME_DIR/${CALLID}.pickedupcall" #this signals that we picked this call up
#to other asynchronously running processes
modem_cmd_errcheck -m any -o "$CALLID" --accept
@@ -110,7 +110,7 @@ hangup() {
#this call was never picked up and hung up immediately, so it is a discarded call
touch "$XDG_RUNTIME_DIR/${CALLID}.discardedcall" #this signals that we discarded this call to other asynchronously running processes
stderr "sxmo_modemcall: Invoking discard hook (async)"
sxmo_hooks.sh discard &
sxmo_hook_discard.sh &
log_event "call_discard" "$CALLID"
fi
modem_cmd_errcheck -m any -o "$CALLID" --hangup
@@ -220,7 +220,7 @@ mute() {
CALLID="$1"
touch "$XDG_RUNTIME_DIR/${CALLID}.mutedring" #this signals that we muted this ring
stderr "Invoking mute_ring hook (async)"
sxmo_hooks.sh mute_ring "$CONTACTNAME" &
sxmo_hook_mute_ring.sh "$CONTACTNAME" &
log_event "ring_mute" "$1"
finish "Ringing with $NUMBER muted"
}

View File

@@ -57,7 +57,7 @@ statenumtoname() {
mainloop() {
# Display the icon
sxmo_hooks.sh statusbar modem_monitor
sxmo_hook_statusbar.sh modem_monitor
PIDS=""
@@ -68,8 +68,8 @@ mainloop() {
done
# fake oldstate (boot) and reason (0)
sxmo_hooks.sh modem "boot" "$newstate" "0"
sxmo_hooks.sh statusbar modem
sxmo_hook_modem.sh "boot" "$newstate" "0"
sxmo_hook_statusbar.sh modem
) &
PIDS="$PIDS $!"
@@ -105,10 +105,10 @@ mainloop() {
read -r oldstate
read -r newstate
read -r reason
sxmo_hooks.sh modem "$(statenumtoname "$oldstate")" \
sxmo_hook_modem.sh "$(statenumtoname "$oldstate")" \
"$(statenumtoname "$newstate")" \
"$(echo "$reason" | sed 's/uint32 //')"
sxmo_hooks.sh statusbar modem
sxmo_hook_statusbar.sh modem
fi
done &
PIDS="$PIDS $!"

View File

@@ -179,6 +179,6 @@ else
fi
sxmo_hooks.sh sendsms "$NUMBER" "$TEXT"
sxmo_hook_sendsms.sh "$NUMBER" "$TEXT"
info "Sent text to $NUMBER message ok"

View File

@@ -39,7 +39,7 @@ processvvm() {
"$SXMO_LOGDIR/$VVM_SENDER/sms.txt" \
"VM: $VVM_SENDER_NAME ($VVM_ID)"
sxmo_hooks.sh sms "$VVM_SENDER" "VVM" "$VVM_ID"
sxmo_hook_sms.sh "$VVM_SENDER" "VVM" "$VVM_ID"
if [ "${SXMO_VVM_AUTO_DELETE:-1}" -eq 1 ]; then
dbus-send --dest=org.kop316.vvm --print-reply /org/kop316/vvm/modemmanager/"$VVM_ID" org.kop316.vvm.Message.Delete

View File

@@ -11,7 +11,7 @@ handlenewnotiffile(){
sxmo_log "Invalid notification file $NOTIFFILE found (<3 lines -- see notif spec in sxmo_notifwrite.sh), deleting!"
rm -f "$NOTIFFILE"
else
sxmo_hooks.sh notification "$NOTIFFILE" &
sxmo_hook_notification.sh "$NOTIFFILE" &
NOTIFACTION="$(awk NR==1 "$NOTIFFILE")"
NOTIFWATCHFILE="$(awk NR==2 "$NOTIFFILE")"
NOTIFMSG="$(tail -n+3 "$NOTIFFILE" | cut -c1-70)"

View File

@@ -30,5 +30,5 @@ writenotification() {
writenotification
if grep -q screenoff "$SXMO_STATE"; then
sxmo_hooks.sh lock
sxmo_hook_lock.sh
fi