use acpid for updating panel speaker/headset icon
authorAmin Bandali <me@aminb.org>
Sat, 7 Mar 2015 17:25:32 +0000 (12:25 -0500)
committerAmin Bandali <me@aminb.org>
Sat, 7 Mar 2015 17:25:32 +0000 (12:25 -0500)
bspwm/.local/bin/spk-icon
other/acpid/events/jack [new file with mode: 0644]
other/acpid/jack.sh [new file with mode: 0755]

index 216fbf4..10a2e7c 100755 (executable)
@@ -1,5 +1,5 @@
 if $(pamixer --get-mute) ; then
 echo ⮝
 else
 if $(pamixer --get-mute) ; then
 echo ⮝
 else
-echo ⮟
+cat /tmp/spkicon
 fi
 fi
diff --git a/other/acpid/events/jack b/other/acpid/events/jack
new file mode 100644 (file)
index 0000000..338957c
--- /dev/null
@@ -0,0 +1,3 @@
+# Pass all events to our one handler script
+event=jack/*
+action=/etc/acpi/jack.sh %e
diff --git a/other/acpid/jack.sh b/other/acpid/jack.sh
new file mode 100755 (executable)
index 0000000..e71d17d
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+# acpi script that takes an entry for headphone actions
+
+case "$1" in
+    jack/headphone)
+        case "$3" in
+            plug)
+                echo "⮜" > /tmp/spkicon
+                ;;
+            unplug)
+                echo "⮟" > /tmp/spkicon
+                ;;
+    esac
+    ;;
+esac
+
+# vim:set ts=4 sw=4 ft=sh et: