~mil/sxmo-devel

sxmo-utils: sxmo_audio.sh: add a busy mode v1 APPLIED

The first patch is a refactorisation to help on the second patch.

This is still to be considered WIP. It works well, but the UI doesn't
feels polished. I'd like to no add any additional bemenu folder. If you
have recommendations \o/
#1237731 test.yml success
sxmo-utils/patches/test.yml: SUCCESS in 22s

[sxmo_audio.sh: add a busy mode][0] from [Willow Barraco][1]

[0]: https://lists.sr.ht/~mil/sxmo-devel/patches/53059
[1]: mailto:contact@willowbarraco.fr

✓ #1237731 SUCCESS sxmo-utils/patches/test.yml https://builds.sr.ht/~mil/job/1237731
Are there issues left with this besides the ui? If not can we merge it
and figure out that ui later?



          
          
          
          
Next
Hey Aren,
Next
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~mil/sxmo-devel/patches/53059/mbox | git am -3
Learn more about email & git

[PATCH sxmo-utils 1/2] sxmo_hook_sms.sh: use a return fast form Export this patch

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
---
 configs/default_hooks/sxmo_hook_sms.sh | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/configs/default_hooks/sxmo_hook_sms.sh b/configs/default_hooks/sxmo_hook_sms.sh
index 87bb9c44..7c853086 100755
--- a/configs/default_hooks/sxmo_hook_sms.sh
+++ b/configs/default_hooks/sxmo_hook_sms.sh
@@ -17,16 +17,16 @@
. sxmo_common.sh

# do nothing if active call
if ! sxmo_modemcall.sh list_active_calls | grep -q active; then

	if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.noring ]; then
		mpv --no-resume-playback --quiet --no-video "$SXMO_TEXTSOUND" >> /dev/null 2>&1 &
	fi

	if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ]; then
		sxmo_vibrate 500 "${SXMO_VIBRATE_STRENGTH:-1}" &
	fi

	wait

if sxmo_modemcall.sh list_active_calls | grep -q active; then
	exit
fi

if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.noring ]; then
	mpv --no-resume-playback --quiet --no-video "$SXMO_TEXTSOUND" >> /dev/null 2>&1 &
fi

if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ]; then
	sxmo_vibrate 500 "${SXMO_VIBRATE_STRENGTH:-1}" &
fi

wait
-- 
2.45.1

[PATCH sxmo-utils 2/2] sxmo_audio.sh: add a busy mode Export this patch

This mode disable ring and vibration from calls and messages. It is also
possible to enable this mode for a period of time.

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
---
 configs/default_hooks/sxmo_hook_ring.sh |  8 ++++++++
 configs/default_hooks/sxmo_hook_sms.sh  |  8 ++++++++
 scripts/core/sxmo_audio.sh              | 16 ++++++++++++++++
 3 files changed, 32 insertions(+)

diff --git a/configs/default_hooks/sxmo_hook_ring.sh b/configs/default_hooks/sxmo_hook_ring.sh
index 8e5af29c..05b6b5ce 100755
--- a/configs/default_hooks/sxmo_hook_ring.sh
+++ b/configs/default_hooks/sxmo_hook_ring.sh
@@ -47,6 +47,14 @@ vibrate() {
	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
fi

# RING & VIBRATE MODE (DEFAULT)
if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.noring ] && [ ! -f "$XDG_CONFIG_HOME"/sxmo/.novibrate ]; then
	sxmo_log "RING AND VIBRATE"
diff --git a/configs/default_hooks/sxmo_hook_sms.sh b/configs/default_hooks/sxmo_hook_sms.sh
index 7c853086..a4b4d44f 100755
--- a/configs/default_hooks/sxmo_hook_sms.sh
+++ b/configs/default_hooks/sxmo_hook_sms.sh
@@ -21,6 +21,14 @@ if sxmo_modemcall.sh list_active_calls | grep -q active; then
	exit
fi

# do nothing if 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
fi

if [ ! -f "$XDG_CONFIG_HOME"/sxmo/.noring ]; then
	mpv --no-resume-playback --quiet --no-video "$SXMO_TEXTSOUND" >> /dev/null 2>&1 &
fi
diff --git a/scripts/core/sxmo_audio.sh b/scripts/core/sxmo_audio.sh
index e9729dc7..9aeea5a4 100755
--- a/scripts/core/sxmo_audio.sh
+++ b/scripts/core/sxmo_audio.sh
@@ -195,6 +195,22 @@ _ringmodesubmenu() {
	else
		printf " %s Vibrate ^ touch \"$XDG_CONFIG_HOME\"/sxmo/.novibrate\n" "$icon_ton"
	fi
	if [ -f "$XDG_CONFIG_HOME"/sxmo/.busy ]; then
		end="$(cat "$XDG_CONFIG_HOME"/sxmo/.busy)"
		if [ -n "$end" ] && [ "$(date +%s)" -gt "$end" ]; then
			rm "$XDG_CONFIG_HOME"/sxmo/.busy
		fi
	fi
	if [ -f "$XDG_CONFIG_HOME"/sxmo/.busy ]; then
		printf " %s Busy ^ rm -f \"$XDG_CONFIG_HOME\"/sxmo/.busy\n" "$icon_ton"
	else
		printf " %s Busy ^ touch \"$XDG_CONFIG_HOME\"/sxmo/.busy\n" "$icon_tof"
		printf " %s Busy for 15 min ^ date '+%%s+15*60' | bc > \"$XDG_CONFIG_HOME\"/sxmo/.busy\n" "$icon_tmr"
		printf " %s Busy for 30 min ^ date '+%%s+30*60' | bc > \"$XDG_CONFIG_HOME\"/sxmo/.busy\n" "$icon_tmr"
		printf " %s Busy for 1 hour ^ date '+%%s+60*60' | bc > \"$XDG_CONFIG_HOME\"/sxmo/.busy\n" "$icon_tmr"
		printf " %s Busy for 2 hour ^ date '+%%s+2*60*60' | bc > \"$XDG_CONFIG_HOME\"/sxmo/.busy\n" "$icon_tmr"
		printf " %s Busy for 3 hour ^ date '+%%s+3*60*60' | bc > \"$XDG_CONFIG_HOME\"/sxmo/.busy\n" "$icon_tmr"
	fi
}

menuchoices() {
-- 
2.45.1
sxmo-utils/patches/test.yml: SUCCESS in 22s

[sxmo_audio.sh: add a busy mode][0] from [Willow Barraco][1]

[0]: https://lists.sr.ht/~mil/sxmo-devel/patches/53059
[1]: mailto:contact@willowbarraco.fr

✓ #1237731 SUCCESS sxmo-utils/patches/test.yml https://builds.sr.ht/~mil/job/1237731
Are there issues left with this besides the ui? If not can we merge it
and figure out that ui later?