Browse Source

Add query subcommand (only is_muted supported so far)

Alois Mahdal 9 years ago
parent
commit
e138ad678b
1 changed files with 16 additions and 2 deletions
  1. 16
    2
      src/libexec/saturnin-au

+ 16
- 2
src/libexec/saturnin-au View File

@@ -10,6 +10,7 @@ usage() {
10 10
             "down"   \
11 11
             "flip"   \
12 12
             "mute"   \
13
+            "query is_muted" \
13 14
             "unmute"
14 15
 }
15 16
 
@@ -55,6 +56,18 @@ do_mute() {
55 56
     amixer -q sset Master mute
56 57
 }
57 58
 
59
+do_query() {
60
+    #
61
+    # Query properties
62
+    #
63
+    local query="$1"
64
+    debug -v query
65
+    case "$query" in
66
+        is_muted) sound_is_muted; return $? ;;
67
+        *)        usage                     ;;
68
+    esac
69
+}
70
+
58 71
 do_up() {
59 72
     #
60 73
     # turn volume up
@@ -76,6 +89,7 @@ while true; do case "$1" in
76 89
     down)   action=down;   shift ;;
77 90
     flip)   action=flip;   shift ;;
78 91
     mute)   action=mute;   shift ;;
92
+    query)  action=query;  shift ; break ;;
79 93
     unmute) action=unmute; shift ;;
80 94
     "")     break                ;;
81 95
     *)      usage                ;;
@@ -85,6 +99,6 @@ debug "\$@='$@'"
85 99
 debug -v action
86 100
 
87 101
 case $action in
88
-    up|down|flip|mute|unmute) do_$action ;;
89
-    *)                        usage      ;;
102
+    up|down|flip|mute|query|unmute) do_$action "$@" ;;
103
+    *)                              usage           ;;
90 104
 esac