~mil/sxmo-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
6 3

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

Details
Message ID
<20240531164249.12801-4-contact@willowbarraco.fr>
DKIM signature
pass
Download raw message
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/

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

Details
Message ID
<20240531164249.12801-5-contact@willowbarraco.fr>
In-Reply-To
<20240531164249.12801-4-contact@willowbarraco.fr> (view parent)
DKIM signature
pass
Download raw message
Patch: +12 -12
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

Details
Message ID
<20240531164249.12801-6-contact@willowbarraco.fr>
In-Reply-To
<20240531164249.12801-4-contact@willowbarraco.fr> (view parent)
DKIM signature
pass
Download raw message
Patch: +32 -0
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] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<D1NZB922YU7F.34V0JJ3JKWKQ0@fra01>
In-Reply-To
<20240531164249.12801-6-contact@willowbarraco.fr> (view parent)
DKIM signature
missing
Download raw message
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]: contact@willowbarraco.fr

✓ #1237731 SUCCESS sxmo-utils/patches/test.yml https://builds.sr.ht/~mil/job/1237731

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

Details
Message ID
<shoi2qn3sgj3rsxvrxxdggjvu7uyzeeaistaozetocoeuje2iy@a4kl75jg6mu4>
In-Reply-To
<20240531164249.12801-6-contact@willowbarraco.fr> (view parent)
DKIM signature
pass
Download raw message
Are there issues left with this besides the ui? If not can we merge it
and figure out that ui later?

> +	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"

Would it be possible to handle custom time periods? Perhaps we could
borrow the duration logic from the wakelock code and use the same
format?

I think this might require a sub-menu to avoid extra complexity with
parsing. Does adding that help clarify how the ui should look at all?

> +	fi
>  }
>  
>  menuchoices() {
> -- 
> 2.45.1
> 

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

Details
Message ID
<D2M1CACN81MV.14GPYBXJZF9NY@willowbarraco.fr>
In-Reply-To
<shoi2qn3sgj3rsxvrxxdggjvu7uyzeeaistaozetocoeuje2iy@a4kl75jg6mu4> (view parent)
DKIM signature
pass
Download raw message
Hey Aren,

> Are there issues left with this besides the ui? If not can we merge it
> and figure out that ui later?

No, this still works well.

> > +	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"
>
> Would it be possible to handle custom time periods? Perhaps we could
> borrow the duration logic from the wakelock code and use the same
> format?
>
> I think this might require a sub-menu to avoid extra complexity with
> parsing. Does adding that help clarify how the ui should look at all?

Yes but I'd like to avoid sub-menus. Particularly in that one, with
entries that are not typeable by the user anyway.

But yes, to make busy timeout typeable to the user, probably we have to
add a dedicated menu.
Details
Message ID
<725ghrholn2ithez4jcmzgcthtq6gvtfkn7kzswwq3d45sudew@mh6uqdxd7l57>
In-Reply-To
<20240531164249.12801-4-contact@willowbarraco.fr> (view parent)
DKIM signature
pass
Download raw message
Merging, this seems like a good feature to have, and we can polish the
UI later.

During testing I noticed that the notification sounds are still played
for incoming texts, I'm not sure if that's intentional.

To git.sr.ht:~mil/sxmo-utils
   20a89df..23617f1  23617f1 -> master

On Fri, May 31, 2024 at 06:41:34PM GMT, Willow Barraco wrote:
> 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/
> 
Reply to thread Export thread (mbox)