~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 2

[PATCH sxmo-docs] document audiostart, discard, and mute_ring hooks. Add footnote for default behaviour

Details
Message ID
<20210923184206.316319-1-anjan@momi.ca>
DKIM signature
pass
Download raw message
Patch: +36 -12
---
 USERGUIDE.md | 48 ++++++++++++++++++++++++++++++++++++------------
 1 file changed, 36 insertions(+), 12 deletions(-)

diff --git a/USERGUIDE.md b/USERGUIDE.md
index 2fa8a84..40ba81e 100644
--- a/USERGUIDE.md
+++ b/USERGUIDE.md
@@ -479,26 +479,26 @@ refer to [the changelog](https://git.sr.ht/~mil/sxmo-docs/tree/master/CHANGELOG.
      <td>Directory or file to place user scripts which will automatically appear in the menu system</td>
    </tr>
    <tr>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/ring</td>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/ring [^1]</td>
      <td>
	<p>Executable script to run when the phone is receiving a call / rings</p>
	<p>This script is called with "$1" set to the incoming number and contact name.</p>
      </td>
    </tr>
    <tr>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/pickup</td>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/pickup [^1]</td>
      <td>
	<p>Executable script to run when the phone is accepting an incoming call</p>
      </td>
    </tr>
    <tr>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/missed_call</td>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/missed_call [^1]</td>
      <td>
	<p>Executable script to run when the phone missed an incoming call</p>
      </td>
    </tr>
    <tr>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/sms</td>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/sms [^1]</td>
      <td>
	<p>Executable script to run when the phone is receiving a text</p>
	<p>This script is called with "$1" set to the incoming number and contact name.</p>
@@ -515,12 +515,12 @@ refer to [the changelog](https://git.sr.ht/~mil/sxmo-docs/tree/master/CHANGELOG.
      menu (see sxmo_appmenu.sh)</td>
    </tr>
    <tr>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/presuspend</td>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/presuspend [^1]</td>
      <td>Executable script that is executed prior to suspending the device. If the exit code of this script is
      non-zero, suspend will be cancelled</td>
    </tr>
    <tr>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/postwake</td>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/postwake [^1]</td>
      <td>Executable script that is executed after waking from suspension. </td>
    </tr>
    <tr>
@@ -528,33 +528,52 @@ refer to [the changelog](https://git.sr.ht/~mil/sxmo-docs/tree/master/CHANGELOG.
      <td>Executable script that is executed every time the device temporarily wakes. You can use this script to check notifications from whatever back-end you desire. The temporary wake interval (in seconds )can be configured using the environment variable $SXMO_RTCWAKEINTERVAL . If this script exits with a non-zero exit code, suspension will be cancelled.</td>
    </tr>
    <tr>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/lock</td>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/lock [^1]</td>
      <td>Executable script that is executed prior to locking the device</td>
    </tr>
    <tr>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/unlock</td>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/unlock [^1]</td>
      <td>Executable script that is executed immediately after unlocking the device</td>
    </tr>
    <tr>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/lisgdstart</td>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/lisgdstart [^1]</td>
      <td>Script that is executed to start the gesture deamon, overrides the defaults (see ``sxmo_lisgdstart.sh``). This
      allows defining custom gestures.</td>
    </tr>
    <tr>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/inputhandler</td>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/inputhandler [^1]</td>
      <td>Script that is executed when a gesture is to be interpreted. It is passed the WM_CLASS of the active window as
      first parameter and the identifier/name of the gesture (or command to run) in the second argument, as configured with lisgd. See
      ``sxmo_inputhandler.sh`` for details. This script allows you to define your own context-sensitive (i.e. application
      specific) gestures.
      </td>
    </tr>
    <tr>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/audiostart [^1]</td>
      <td>
      </td>
      <td>This script is run by the default sway or xinit startup script to
      "Force audio over the main speaker and and set a sane default volume".
      </td>
    </tr>
    <tr>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/discard [^1]</td>
      <td>This script is executed (asynchronously) when you discard an incoming
      call
      </td>
    </tr>
    <tr>
      <td>$XDG_CONFIG_HOME/sxmo/hooks/mute_ring [^1]</td>
      <td>This script is executed (asynchronously) when you mute an incoming call
      </td>
    </tr>
	<tr>
		<td>$XDG_CONFIG_HOME/sxmo/hooks/notification</td>
		<td>$XDG_CONFIG_HOME/sxmo/hooks/notification [^1]</td>
		<td>This script will run whenever any kind of notification is received. It can be used for example to blink the
		led if you want to override the default behaviour</td>
	</tr>
	<tr>
		<td>$XDG_CONFIG_HOME/sxmo/hooks/unlocksim</td>
		<td>$XDG_CONFIG_HOME/sxmo/hooks/unlocksim [^1]</td>
		<td>This hook will run when your SIM needs to be unlocked with a PIN code. You can consider putting
            something like ``mmcli -i 0 --pin 1234`` in it to unlock automatically, if you don't mind the negative security implications
            that carries in case your device gets compromised.</td>
@@ -564,6 +583,11 @@ refer to [the changelog](https://git.sr.ht/~mil/sxmo-docs/tree/master/CHANGELOG.

Note: `$XDG_CONFIG_HOME` by default is equal to `~/.config`

[^1]: If a user-defined hook file does not exist on activity, sxmo will run the
corresponding project defined default hook from `/usr/share/sxmo/default_hooks/`.
For example, if you pickup a call and `$XDG_CONFIG_HOME/sxmo/hooks/pickup` does
not exist, `/usr/share/sxmo/default_hooks/pickup` will be run.


### **Logging**

-- 
2.30.2

Re: [PATCH sxmo-docs] document audiostart, discard, and mute_ring hooks. Add footnote for default beh

Details
Message ID
<3SF8MFJ47CM7L.24JB8DK7HK9EV@stacyharper.net>
In-Reply-To
<20210923184206.316319-1-anjan@momi.ca> (view parent)
DKIM signature
pass
Download raw message
> ---
>  USERGUIDE.md | 48 ++++++++++++++++++++++++++++++++++++------------
>  1 file changed, 36 insertions(+), 12 deletions(-)
> 
> diff --git a/USERGUIDE.md b/USERGUIDE.md
> index 2fa8a84..40ba81e 100644
> --- a/USERGUIDE.md
> +++ b/USERGUIDE.md
> @@ -479,26 +479,26 @@ refer to [the changelog](https://git.sr.ht/~mil/sxmo-docs/tree/master/CHANGELOG.
>        <td>Directory or file to place user scripts which will automatically appear in the menu system</td>
>      </tr>
>      <tr>
> -      <td>$XDG_CONFIG_HOME/sxmo/hooks/ring</td>
> +      <td>$XDG_CONFIG_HOME/sxmo/hooks/ring [^1]</td>
>        <td>
>  	<p>Executable script to run when the phone is receiving a call / rings</p>
>  	<p>This script is called with "$1" set to the incoming number and contact name.</p>
>        </td>
>      </tr>
>      <tr>
> -      <td>$XDG_CONFIG_HOME/sxmo/hooks/pickup</td>
> +      <td>$XDG_CONFIG_HOME/sxmo/hooks/pickup [^1]</td>
>        <td>
>  	<p>Executable script to run when the phone is accepting an incoming call</p>
>        </td>
>      </tr>
>      <tr>
> -      <td>$XDG_CONFIG_HOME/sxmo/hooks/missed_call</td>
> +      <td>$XDG_CONFIG_HOME/sxmo/hooks/missed_call [^1]</td>
>        <td>
>  	<p>Executable script to run when the phone missed an incoming call</p>
>        </td>
>      </tr>
>      <tr>
> -      <td>$XDG_CONFIG_HOME/sxmo/hooks/sms</td>
> +      <td>$XDG_CONFIG_HOME/sxmo/hooks/sms [^1]</td>
>        <td>
>  	<p>Executable script to run when the phone is receiving a text</p>
>  	<p>This script is called with "$1" set to the incoming number and contact name.</p>
> @@ -515,12 +515,12 @@ refer to [the changelog](https://git.sr.ht/~mil/sxmo-docs/tree/master/CHANGELOG.
>        menu (see sxmo_appmenu.sh)</td>
>      </tr>
>      <tr>
> -      <td>$XDG_CONFIG_HOME/sxmo/hooks/presuspend</td>
> +      <td>$XDG_CONFIG_HOME/sxmo/hooks/presuspend [^1]</td>
>        <td>Executable script that is executed prior to suspending the device. If the exit code of this script is
>        non-zero, suspend will be cancelled</td>
>      </tr>
>      <tr>
> -      <td>$XDG_CONFIG_HOME/sxmo/hooks/postwake</td>
> +      <td>$XDG_CONFIG_HOME/sxmo/hooks/postwake [^1]</td>
>        <td>Executable script that is executed after waking from suspension. </td>
>      </tr>
>      <tr>
> @@ -528,33 +528,52 @@ refer to [the changelog](https://git.sr.ht/~mil/sxmo-docs/tree/master/CHANGELOG.
>        <td>Executable script that is executed every time the device temporarily wakes. You can use this script to check notifications from whatever back-end you desire. The temporary wake interval (in seconds )can be configured using the environment variable $SXMO_RTCWAKEINTERVAL . If this script exits with a non-zero exit code, suspension will be cancelled.</td>
>      </tr>
>      <tr>
> -      <td>$XDG_CONFIG_HOME/sxmo/hooks/lock</td>
> +      <td>$XDG_CONFIG_HOME/sxmo/hooks/lock [^1]</td>
>        <td>Executable script that is executed prior to locking the device</td>
>      </tr>
>      <tr>
> -      <td>$XDG_CONFIG_HOME/sxmo/hooks/unlock</td>
> +      <td>$XDG_CONFIG_HOME/sxmo/hooks/unlock [^1]</td>
>        <td>Executable script that is executed immediately after unlocking the device</td>
>      </tr>
>      <tr>
> -      <td>$XDG_CONFIG_HOME/sxmo/hooks/lisgdstart</td>
> +      <td>$XDG_CONFIG_HOME/sxmo/hooks/lisgdstart [^1]</td>
>        <td>Script that is executed to start the gesture deamon, overrides the defaults (see ``sxmo_lisgdstart.sh``). This
>        allows defining custom gestures.</td>
>      </tr>
>      <tr>
> -      <td>$XDG_CONFIG_HOME/sxmo/hooks/inputhandler</td>
> +      <td>$XDG_CONFIG_HOME/sxmo/hooks/inputhandler [^1]</td>
>        <td>Script that is executed when a gesture is to be interpreted. It is passed the WM_CLASS of the active window as
>        first parameter and the identifier/name of the gesture (or command to run) in the second argument, as configured with lisgd. See
>        ``sxmo_inputhandler.sh`` for details. This script allows you to define your own context-sensitive (i.e. application
>        specific) gestures.
>        </td>
> +    </tr>
> +    <tr>
> +      <td>$XDG_CONFIG_HOME/sxmo/hooks/audiostart [^1]</td>

Is it a new hook? Something like "start" and "stop" would be better no?

> +      <td>
> +      </td>
> +      <td>This script is run by the default sway or xinit startup script to
> +      "Force audio over the main speaker and and set a sane default volume".
> +      </td>
> +    </tr>
> +    <tr>
> +      <td>$XDG_CONFIG_HOME/sxmo/hooks/discard [^1]</td>
> +      <td>This script is executed (asynchronously) when you discard an incoming
> +      call
> +      </td>
> +    </tr>
> +    <tr>
> +      <td>$XDG_CONFIG_HOME/sxmo/hooks/mute_ring [^1]</td>
> +      <td>This script is executed (asynchronously) when you mute an incoming call
> +      </td>
>      </tr>
>  	<tr>
> -		<td>$XDG_CONFIG_HOME/sxmo/hooks/notification</td>
> +		<td>$XDG_CONFIG_HOME/sxmo/hooks/notification [^1]</td>
>  		<td>This script will run whenever any kind of notification is received. It can be used for example to blink the
>  		led if you want to override the default behaviour</td>
>  	</tr>
>  	<tr>
> -		<td>$XDG_CONFIG_HOME/sxmo/hooks/unlocksim</td>
> +		<td>$XDG_CONFIG_HOME/sxmo/hooks/unlocksim [^1]</td>
>  		<td>This hook will run when your SIM needs to be unlocked with a PIN code. You can consider putting
>              something like ``mmcli -i 0 --pin 1234`` in it to unlock automatically, if you don't mind the negative security implications
>              that carries in case your device gets compromised.</td>
> @@ -564,6 +583,11 @@ refer to [the changelog](https://git.sr.ht/~mil/sxmo-docs/tree/master/CHANGELOG.
>  
>  Note: `$XDG_CONFIG_HOME` by default is equal to `~/.config`
>  
> +[^1]: If a user-defined hook file does not exist on activity, sxmo will run the
> +corresponding project defined default hook from `/usr/share/sxmo/default_hooks/`.
> +For example, if you pickup a call and `$XDG_CONFIG_HOME/sxmo/hooks/pickup` does
> +not exist, `/usr/share/sxmo/default_hooks/pickup` will be run.
> +
>  
>  ### **Logging**
>  

Re: [PATCH sxmo-docs] document audiostart, discard, and mute_ring hooks. Add footnote for default beh

Details
Message ID
<87a6k1jspy.fsf@navi>
In-Reply-To
<3SF8MFJ47CM7L.24JB8DK7HK9EV@stacyharper.net> (view parent)
DKIM signature
pass
Download raw message
Stacy Harper <contact@stacyharper.net> writes:

>> +    </tr>
>> +    <tr>
>> +      <td>$XDG_CONFIG_HOME/sxmo/hooks/audiostart [^1]</td>
>
> Is it a new hook? Something like "start" and "stop" would be better no?
>

Oh derp, it might be a new hook. According to git log configs/default_hooks/audiostart:

commit 61451f62928ca04cf7bc954f9832a57913813520
Author: Maarten van Gompel <proycon@anaproy.nl>

    added a default audiostart hook to force output over main speaker and set a sane default volume

    Signed-off-by: Stacy Harper <contact@stacyharper.net>

So feel free to commit and take lines referencing it out till we release
the next version of sxmo.

Rest of the commit should be good
-- 
w:] www.momi.ca
pgp:] https://momi.ca/publickey.txt

Re: [PATCH sxmo-docs] document audiostart, discard, and mute_ring hooks. Add footnote for default

Details
Message ID
<2EET6HPJY0197.2OX4AC445VI3T@stacyharper.net>
In-Reply-To
<87a6k1jspy.fsf@navi> (view parent)
DKIM signature
pass
Download raw message
What do you think about my suggestion ? Using a "start" and "stop" hooks
instead of "audiostart" ? (I already got a "stop" hook in my tree that I
did not pushed yet)

Re: [PATCH sxmo-docs] document audiostart, discard, and mute_ring hooks. Add footnote for default

Details
Message ID
<871r5cj5jz.fsf@navi>
In-Reply-To
<2EET6HPJY0197.2OX4AC445VI3T@stacyharper.net> (view parent)
DKIM signature
pass
Download raw message
Stacy Harper <contact@stacyharper.net> writes:

> What do you think about my suggestion ? Using a "start" and "stop" hooks
> instead of "audiostart" ? (I already got a "stop" hook in my tree that I
> did not pushed yet)

Im not against it in principle but can you describe the utility? Like what
would someone put in the stop hook? Im assuming like muting certain
sinks and not others?

-- 
w:] www.momi.ca
pgp:] https://momi.ca/publickey.txt

Re: [PATCH sxmo-docs] document audiostart, discard, and mute_ring hooks. Add footnote for default

Details
Message ID
<3FXKBAFLQLWR3.3T4B4EYJ7MFTN@stacyharper.net>
In-Reply-To
<871r5cj5jz.fsf@navi> (view parent)
DKIM signature
pass
Download raw message
> Im not against it in principle but can you describe the utility? Like what
> would someone put in the stop hook? Im assuming like muting certain
> sinks and not others?

By example, thats my current wm_shutdown hook. It kill pipewire and
other daemons. Force bemenu and wvkbd to close. It kill my irc bot.

As sway can crash, it make tinydm restart to bring me a new working
environment whithout dangling daemons

pkill pipewire
pkill mpd
pkill remind
pkill pigeon-receive
pkill bemenu
pkill wvkbd-mobintl

SXMOBOTIPC="${XDG_RUNTIME_DIR:-$HOME/.local/run}/sxmobot.ipc"
printf "Stop\n" >> "$SXMOBOTIPC"

Re: [PATCH sxmo-docs] document audiostart, discard, and mute_ring hooks. Add footnote for default

Details
Message ID
<87sfxpi9iv.fsf@navi>
In-Reply-To
<3FXKBAFLQLWR3.3T4B4EYJ7MFTN@stacyharper.net> (view parent)
DKIM signature
pass
Download raw message
> By example, thats my current wm_shutdown hook. It kill pipewire and
> other daemons. Force bemenu and wvkbd to close. It kill my irc bot.
>
> As sway can crash, it make tinydm restart to bring me a new working
> environment whithout dangling daemons
>
> pkill pipewire
> pkill mpd
> pkill remind
> pkill pigeon-receive
> pkill bemenu
> pkill wvkbd-mobintl
>
> SXMOBOTIPC="${XDG_RUNTIME_DIR:-$HOME/.local/run}/sxmobot.ipc"
> printf "Stop\n" >> "$SXMOBOTIPC"

Sounds good, lets put this on the back burner for now and merge a start
and stop hook. Then we can come back to this patch. Do not mark this
patch as needs revision cause then it will get buried and we will forget
the docs are outdated.

Cheers,
Anjandev Momi
-- 
w:] www.momi.ca
pgp:] https://momi.ca/publickey.txt
Reply to thread Export thread (mbox)