sxmo-userscripts: Add hooks directory and android_buttons hook v1 SUPERSEDED

~flimflam: 1
 Add hooks directory and android_buttons hook

 3 files changed, 100 insertions(+), 0 deletions(-)
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/~anjan/public-inbox/patches/25604/mbox | git am -3
Learn more about email & git

[PATCH sxmo-userscripts] Add hooks directory and android_buttons hook Export this patch

From: David Kennedy <qpg7x5@masqt.com>

 hooks/README.md                    | 35 ++++++++++++++++++++++
 hooks/inputhandler/README.md       | 17 +++++++++++
 hooks/inputhandler/android_buttons | 48 ++++++++++++++++++++++++++++++
 3 files changed, 100 insertions(+)
 create mode 100644 hooks/README.md
 create mode 100644 hooks/inputhandler/README.md
 create mode 100755 hooks/inputhandler/android_buttons

diff --git a/hooks/README.md b/hooks/README.md
new file mode 100644
index 0000000..3b933b0
--- /dev/null
+++ b/hooks/README.md
@@ -0,0 +1,35 @@
# User hooks

This directory contains example hooks contributed by the community.

# Usage

To use one of these hooks, copy it to `$XDG_CONFIG_HOME/sxmo/hooks/[name]`,
where `[name]` is the name of the directory containing the file, and make it

For example:

$ cp inputhandler/android_buttons $XDG_CONFIG_HOME/sxmo/hooks/inputhandler
$ chmod u+x $XDG_CONFIG_HOME/sxmo/hooks/inputhandler

# Contributing

Add your own hooks under a directory corresponding to the hook name and rename
the file itself something descriptive. This way, we can have multiple examples
of each type of hook organized like so:


Please also add a brief description of your hook to the README in its parent

diff --git a/hooks/inputhandler/README.md b/hooks/inputhandler/README.md
new file mode 100644
index 0000000..ebda088
--- /dev/null
+++ b/hooks/inputhandler/README.md
@@ -0,0 +1,17 @@
# inputhandler hooks

This directory contains example inputhandler hooks.

# Caveats

As of version 1.5.1, this hook is only executed when the screen is unlocked.
It's not possible to modify the behavior of the power button when locked.

# Contents

## android_buttons
- Author: David Kennedy
- License: WTFPL
- Description: Modifies the hardware button behavior to mimic a typical Android

diff --git a/hooks/inputhandler/android_buttons b/hooks/inputhandler/android_buttons
new file mode 100755
index 0000000..99310a8
--- /dev/null
+++ b/hooks/inputhandler/android_buttons
@@ -0,0 +1,48 @@

# This hook modifies the hardware button behavior to mimic a typical Android
# device, i.e.:
# - The power button locks the screen and turns it off
# - The volume up button turns the volume up
# - The volume down button turns the volume down
# It also adds a couple features that don't normally exist on Android:
# - Holding the power button enters CRUST suspend
# - Holding the volume down button mutes the volume
# You still have to hold down the power button to unlock the screen.


# You must exit 0 if you handled the input to not trigger default behaviors

case "$ACTION" in
		sxmo_screenlock.sh crust
		exit 0
		sxmo_screenlock.sh off
		exit 0
		sxmo_vol.sh unmute
		sxmo_vol.sh up
		exit 0
		sxmo_vol.sh mute
		exit 0
		sxmo_vol.sh down
		exit 0

exit 1