aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/audio-volume-control/monitor
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-04-25 15:09:25 +0200
committerMattias Andrée <maandree@operamail.com>2015-04-25 15:09:25 +0200
commitbead40c7d0d8782f84749e610d2422b802101782 (patch)
treeb198c5df232ee7dae9302e704f6235b87fb84b38 /doc/examples/audio-volume-control/monitor
parentadd message length restriction and message format to readme (diff)
downloadbus-bead40c7d0d8782f84749e610d2422b802101782.tar.gz
bus-bead40c7d0d8782f84749e610d2422b802101782.tar.bz2
bus-bead40c7d0d8782f84749e610d2422b802101782.tar.xz
add example audio-volume-control
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rwxr-xr-xdoc/examples/audio-volume-control/monitor15
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/examples/audio-volume-control/monitor b/doc/examples/audio-volume-control/monitor
new file mode 100755
index 0000000..82fe7bc
--- /dev/null
+++ b/doc/examples/audio-volume-control/monitor
@@ -0,0 +1,15 @@
+#!/bin/sh
+if [ $# = 1 ]; then
+ if [ "$(echo "${1}" | cut -d ' ' -f 2)" = "volume-changed" ]; then
+ printf '\e[H\e[2J'
+ amixer get Master
+ fi
+ exit 0
+fi
+
+exec 2>/dev/null
+
+printf '\e[?1049h\e[H\e[2J'
+trap -- "printf '\e[?1049l'" SIGINT
+bus listen "/tmp/example-bus" \'"${0/\'/\'\\\'\'}"\'' "${arg}"'
+