Rename sxmo_jobs.sh from sxmo_daemons.sh

A long time ago I said I should rename this. And I finally did it.
sxmo_jobs.sh is a more appropriate name for the intention behind this script.
This commit is contained in:
Willow Barraco
2023-10-11 17:36:59 +02:00
parent f479a599f6
commit bbec613e8a
19 changed files with 47 additions and 47 deletions

View File

@@ -2,7 +2,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
sxmo_jobs.sh start idle_locker sxmo_idle.sh -w \
timeout 10 'sxmo_wm.sh dpms on' \
resume 'sxmo_wm.sh dpms off'

View File

@@ -6,8 +6,8 @@ sxmo_wakelock.sh lock sxmo_not_screenoff infinite
# Go to locker after 5 minutes of inactivity
if [ -e "$XDG_CACHE_HOME/sxmo/sxmo.noidle" ]; then
sxmo_daemons.sh stop idle_locker
sxmo_jobs.sh stop idle_locker
else
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
sxmo_jobs.sh start idle_locker sxmo_idle.sh -w \
timeout 300 'sxmo_hook_locker.sh'
fi

View File

@@ -21,7 +21,7 @@ if [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nogesture ]; then
fi
# suspend after if no activity after 120s
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
sxmo_jobs.sh start idle_locker sxmo_idle.sh -w \
timeout "1" '' \
resume "sxmo_wakelock.sh lock sxmo_stay_awake \"${SXMO_UNLOCK_IDLE_TIME:-120}s\""

View File

@@ -19,7 +19,7 @@ superd_service_isrunning() {
}
sxmo_service_isrunning() {
sxmo_daemons.sh running "$1" > /dev/null
sxmo_jobs.sh running "$1" > /dev/null
}
if [ -z "$XPROPOUT" ]; then
@@ -90,11 +90,11 @@ case "$WMCLASS" in
[ -e "$XDG_CACHE_HOME/sxmo/sxmo.noidle" ] && printf "%s" "$icon_tof" || printf "%s" "$icon_ton"
) ^ 1 ^ (rm $XDG_CACHE_HOME/sxmo/sxmo.noidle 2>/dev/null || touch $XDG_CACHE_HOME/sxmo/sxmo.noidle) && sxmo_state_switch.sh set unlock
$icon_ror Autorotate $(
sxmo_daemons.sh running autorotate -q &&
sxmo_jobs.sh running autorotate -q &&
printf "%s" "$icon_ton" || printf "%s" "$icon_tof"
) ^ 1 ^ toggle_daemon 'Autorotate' autorotate sxmo_autorotate.sh
$([ -n "$SXMO_KEYBOARD_SLIDER_EVENT_DEVICE" ] && echo "$icon_ror Autorotate on Keyboard Open/Close $(
sxmo_daemons.sh running kb_autorotate -q &&
sxmo_jobs.sh running kb_autorotate -q &&
printf "%s" "$icon_ton" || printf "%s" "$icon_tof"
) ^ 1 ^ toggle_daemon 'Keyboard Autorotate' kb_autorotate sxmo_keyboard_autorotate.sh")
$icon_ror Rotate ^ 1 ^ sxmo_rotate.sh rotate

View File

@@ -9,7 +9,7 @@
# Create xdg user directories, such as ~/Pictures
xdg-user-dirs-update
sxmo_daemons.sh start daemon_manager superd
sxmo_jobs.sh start daemon_manager superd
# let time to superd to start correctly
while ! superctl status > /dev/null 2>&1; do
@@ -32,7 +32,7 @@ fi
# Periodically update some status bar components
sxmo_hook_statusbar.sh all
sxmo_daemons.sh start statusbar_periodics sxmo_run_aligned.sh 60 \
sxmo_jobs.sh start statusbar_periodics sxmo_run_aligned.sh 60 \
sxmo_hook_statusbar.sh periodics
# mako/dunst are required for warnings.

View File

@@ -27,7 +27,7 @@ set_state() {
return
fi
if sxmo_daemons.sh running proximity_lock; then
if sxmo_jobs.sh running proximity_lock; then
sxmobar -a -e bold -f orange state 90 "$icon_state_proximity" # circle with dot
return
fi

View File

@@ -12,7 +12,7 @@ ACTION="$1"
. sxmo_common.sh
stop_proximity_lock() {
sxmo_daemons.sh stop proximity_lock
sxmo_jobs.sh stop proximity_lock
}
XPROPOUT="$(sxmo_wm.sh focusedwindow)"

View File

@@ -24,12 +24,12 @@ sxmo_led.sh blink blue &
sxmo_wm.sh dpms off
sxmo_wm.sh inputevent touchscreen off
sxmo_daemons.sh stop periodic_blink
sxmo_daemons.sh stop periodic_wakelock_check
sxmo_jobs.sh stop periodic_blink
sxmo_jobs.sh stop periodic_wakelock_check
# 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 \
sxmo_jobs.sh start idle_locker sxmo_idle.sh -w \
timeout "${SXMO_LOCK_IDLE_TIME:-8}" "sxmo_state_switch.sh set screenoff"
fi

View File

@@ -22,13 +22,13 @@ sxmo_led.sh blink red blue &
sxmo_wm.sh dpms on
sxmo_wm.sh inputevent touchscreen off
sxmo_daemons.sh start periodic_blink sxmo_run_periodically.sh - 2 sxmo_led.sh blink red blue
sxmo_jobs.sh start periodic_blink sxmo_run_periodically.sh - 2 sxmo_led.sh blink red blue
case "$SXMO_WM" in
dwm)
# dmenu will grab input focus (i.e. power button) so kill it before going to
# screenoff unless proximity lock is running (i.e. there's a phone call).
if ! sxmo_daemons.sh running proximity_lock -q; then
if ! sxmo_jobs.sh running proximity_lock -q; then
sxmo_dmenu.sh close
fi
;;
@@ -36,6 +36,6 @@ esac
wait
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
sxmo_jobs.sh start idle_locker sxmo_idle.sh -w \
timeout 3 'sxmo_wakelock.sh unlock sxmo_not_screenoff' \
resume 'sxmo_wakelock.sh lock sxmo_not_screenoff infinite'

View File

@@ -15,23 +15,23 @@ sxmo_led.sh blink red green &
sxmo_wm.sh dpms off
sxmo_wm.sh inputevent touchscreen on
sxmo_daemons.sh stop periodic_blink
sxmo_daemons.sh stop periodic_wakelock_check
sxmo_jobs.sh stop periodic_blink
sxmo_jobs.sh stop periodic_wakelock_check
# Go to lock after 120 seconds of inactivity
if [ -e "$XDG_CACHE_HOME/sxmo/sxmo.noidle" ]; then
sxmo_daemons.sh stop idle_locker
sxmo_jobs.sh stop idle_locker
else
case "$SXMO_WM" in
sway)
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
sxmo_jobs.sh start idle_locker sxmo_idle.sh -w \
timeout "${SXMO_UNLOCK_IDLE_TIME:-120}" 'sh -c "
swaymsg mode default;
exec sxmo_state_switch.sh set lock
"'
;;
dwm)
sxmo_daemons.sh start idle_locker sxmo_idle.sh -w \
sxmo_jobs.sh start idle_locker sxmo_idle.sh -w \
timeout "${SXMO_UNLOCK_IDLE_TIME:-120}" "sxmo_state_switch.sh set lock"
;;
esac

View File

@@ -33,11 +33,11 @@ toggle_daemon() {
name="$1"
shift
if sxmo_daemons.sh running "$1" -q; then
sxmo_daemons.sh stop "$@"
if sxmo_jobs.sh running "$1" -q; then
sxmo_jobs.sh stop "$@"
notify-send "$name Stopped"
else
sxmo_daemons.sh start "$@" &
sxmo_jobs.sh start "$@" &
notify-send "$name Started"
fi
}
@@ -55,13 +55,13 @@ call_entries() {
NUMBER="$(sxmo_modemcall.sh vid_to_number "$CALLID")"
CONTACT="$(sxmo_contacts.sh --name "$NUMBER")"
printf "%s Incoming call %s ^ 0 ^ sxmo_daemons.sh start incall_menu sxmo_modemcall.sh incoming_call_menu %s\n" \
printf "%s Incoming call %s ^ 0 ^ sxmo_jobs.sh start incall_menu sxmo_modemcall.sh incoming_call_menu %s\n" \
"$icon_phn" "$CONTACT" "$CALLID"
;;
*)
[ -n "$shown_incall_menu" ] && continue
shown_incall_menu=1
printf "%s Incall Menu ^ 0 ^ sxmo_daemons.sh start incall_menu sxmo_modemcall.sh incall_menu\n" \
printf "%s Incall Menu ^ 0 ^ sxmo_jobs.sh start incall_menu sxmo_modemcall.sh incall_menu\n" \
"$icon_phn"
;;
esac

View File

@@ -67,7 +67,7 @@ _full_reconnection() {
notify-send 'Make the device discoverable'
bluetoothctl remove '$1'
sxmo_daemons.sh start bluetooth_scan bluetoothctl scan on
sxmo_jobs.sh start bluetooth_scan bluetoothctl scan on
sleep 5
@@ -88,7 +88,7 @@ while : ; do
fi
done
"
sxmo_daemons.sh stop bluetooth_scan
sxmo_jobs.sh stop bluetooth_scan
}
_notify_failure() {
@@ -247,11 +247,11 @@ EOF
;;
"Discovering $icon_ton")
INDEX=5
sxmo_daemons.sh stop bluetooth_scan
sxmo_jobs.sh stop bluetooth_scan
sleep 0.5
;;
"Discovering $icon_tof")
sxmo_daemons.sh start bluetooth_scan bluetoothctl --timeout 60 scan on > /dev/null
sxmo_jobs.sh start bluetooth_scan bluetoothctl --timeout 60 scan on > /dev/null
notify-send "Scanning for 60 seconds"
INDEX=5
sleep 0.5

View File

@@ -6,10 +6,10 @@
# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh
ROOT="$XDG_RUNTIME_DIR/sxmo_daemons"
ROOT="$XDG_RUNTIME_DIR/sxmo_jobs"
mkdir -p "$ROOT"
exec 3<> "$ROOT/daemons.lock"
exec 3<> "$ROOT/jobs.lock"
flock -x 3
list() {

View File

@@ -8,7 +8,7 @@
gracefulexit() {
sxmo_log "gracefully exiting (on signal or after error)"
sxmo_daemons.sh stop network_monitor_device
sxmo_jobs.sh stop network_monitor_device
trap - INT TERM EXIT
}
@@ -26,7 +26,7 @@ nmcli -g GENERAL.TYPE,GENERAL.DEVICE d show | grep . | while read -r type; do
done
# shellcheck disable=2016
sxmo_daemons.sh start network_monitor_device \
sxmo_jobs.sh start network_monitor_device \
nmcli device monitor | stdbuf -o0 awk '
{ newstate=$2 }
/device removed$/ {newstate="disconnected"}

View File

@@ -12,12 +12,12 @@ usage() {
case "$1" in
reboot)
sxmo_hook_power.sh reboot
sxmo_daemons.sh stop all
sxmo_jobs.sh stop all
doas reboot
;;
poweroff)
sxmo_hook_power.sh poweroff
sxmo_daemons.sh stop all
sxmo_jobs.sh stop all
doas poweroff
;;
logout)

View File

@@ -23,7 +23,7 @@ with_dbus() {
}
cleanup() {
sxmo_daemons.sh stop all
sxmo_jobs.sh stop all
pkill bemenu
pkill wvkbd
pkill superd

View File

@@ -45,7 +45,7 @@ with_dbus() {
}
cleanup() {
sxmo_daemons.sh stop all
sxmo_jobs.sh stop all
pkill svkbd
pkill dmenu
pkill superd

View File

@@ -96,15 +96,15 @@ checkforfinishedcalls() {
if ! sxmo_modemcall.sh list_active_calls | grep -q .; then
# Cleanup
sxmo_vibrate 1000 "${SXMO_VIBRATE_STRENGTH:-1}" &
sxmo_daemons.sh stop incall_menu
sxmo_daemons.sh stop proximity_lock
sxmo_jobs.sh stop incall_menu
sxmo_jobs.sh stop proximity_lock
if ! sxmo_modemaudio.sh reset_audio; then
sxmo_notify_user.sh --urgency=critical "We failed to reset call audio"
fi
else
# Or refresh the menu
sxmo_daemons.sh start incall_menu sxmo_modemcall.sh incall_menu
sxmo_jobs.sh start incall_menu sxmo_modemcall.sh incall_menu
fi
done
}
@@ -139,17 +139,17 @@ checkforincomingcalls() {
mkdir -p "$SXMO_LOGDIR"
printf %b "$TIME\tcall_ring\t$INCOMINGNUMBER\n" >> "$SXMO_LOGDIR/modemlog.tsv"
sxmo_daemons.sh start proximity_lock sxmo_proximitylock.sh
sxmo_jobs.sh start proximity_lock sxmo_proximitylock.sh
# If we already got an active call
if sxmo_modemcall.sh list_active_calls \
| grep -v ringing-in \
| grep -q .; then
# Refresh the incall menu
sxmo_daemons.sh start incall_menu sxmo_modemcall.sh incall_menu
sxmo_jobs.sh start incall_menu sxmo_modemcall.sh incall_menu
else
# Or fire the incomming call menu
sxmo_daemons.sh start incall_menu sxmo_modemcall.sh incoming_call_menu "$VOICECALLID"
sxmo_jobs.sh start incall_menu sxmo_modemcall.sh incoming_call_menu "$VOICECALLID"
fi
stderr "Call from number: $INCOMINGNUMBER (VOICECALLID: $VOICECALLID)"

View File

@@ -52,9 +52,9 @@ EOF
return 1
fi
sxmo_daemons.sh start proximity_lock sxmo_proximitylock.sh
sxmo_jobs.sh start proximity_lock sxmo_proximitylock.sh
sxmo_daemons.sh start incall_menu sxmo_modemcall.sh incall_menu
sxmo_jobs.sh start incall_menu sxmo_modemcall.sh incall_menu
}
dial_menu() {