[Debian-eeepc-devel] [SCM] Maintenance of eeepc-acpi-scripts debian package branch, master, updated. 45d1d2f03d6406576a0d767f341689b499c921b1
Damyan Ivanov
dmn at debian.org
Tue Sep 9 07:46:21 UTC 2008
The following commit has been merged in the master branch:
commit 049173d04e4f36b0e4e795858ad2d516f4a8d653
Author: Damyan Ivanov <dmn at debian.org>
Date: Tue Sep 9 10:35:24 2008 +0300
move audio hot key support in actions/volume.sh
diff --git a/actions/hotkey.sh b/actions/hotkey.sh
index a9fd9cd..8545b7c 100755
--- a/actions/hotkey.sh
+++ b/actions/hotkey.sh
@@ -8,6 +8,18 @@
. /etc/acpi/lib/notify.sh
code=$3
+handle_mute_toggle() {
+ /etc/acpi/actions/volume.sh toggle
+}
+
+handle_volume_up() {
+ /etc/acpi/actions/volume.sh up
+}
+
+handle_volume_down() {
+ /etc/acpi/actions/volume.sh down
+}
+
show_wireless() {
detect_wlan
if grep -q $WLAN_IF /proc/net/wireless; then
@@ -18,16 +30,6 @@ show_wireless() {
notify wireless "Wireless $status"
}
-show_muteness() {
- status=$(amixer get $VOLUME_LABEL | sed -n '/%/{s/.*\[\(on\|off\)\].*/\u\1/p;q}')
- notify audio "Audio $status"
-}
-
-show_volume() {
- percent=$(amixer get $VOLUME_LABEL | sed -n '/%/{s/.*\[\(.*\)%\].*/\1/p;q}')
- notify audio "Volume $percent"
-}
-
handle_blank_screen() {
if [ -S /tmp/.X11-unix/X0 ]; then
detect_x_display
@@ -94,28 +96,26 @@ case $code in
;;
# Fn+F7 -- mute/unmute speakers
00000013)
- # muting $VOLUME_LABEL affects the headphone jack but not the speakers
- amixer -q set $VOLUME_LABEL toggle
- # muting $HEADPHONE_LABEL affects the speakers but not the headphone jack
- amixer -q set $HEADPHONE_LABEL toggle
- show_muteness
+ if [ "${FnF7:-handle_mute_toggle}" != 'NONE' ]; then
+ ${FnF7:-handle_mute_toggle}
+ fi
;;
# Fn+F8 -- decrease volume
00000014)
- amixer -q set $VOLUME_LABEL 2- unmute
- amixer -q set $HEADPHONE_LABEL on
- show_volume
+ if [ "${FnF8:-handle_volume_down}" != 'NONE' ]; then
+ ${FnF8:-handle_volume_down}
+ fi
+ ;;
+ # Fn+F9 -- increase volume
+ 00000015)
+ if [ "${FnF9:-handle_volume_up}" != 'NONE' ]; then
+ ${FnF9:-handle_volume_up}
+ fi
;;
# F+F5 -- toggle vga
0000003[012])
/etc/acpi/actions/vga-toggle.sh
;;
- # Fn+F9 -- increase volume
- 00000015)
- amixer -q set $VOLUME_LABEL 2+ unmute
- amixer -q set $HEADPHONE_LABEL on
- show_volume
- ;;
# Fn+F3 -- decrease brightness
# Fn+F4 -- increase brightness
0000002?)
diff --git a/actions/volume.sh b/actions/volume.sh
new file mode 100755
index 0000000..5c06820
--- /dev/null
+++ b/actions/volume.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+# Volume controls
+
+# do nothing if package is removed
+[ -d /usr/share/doc/eeepc-acpi-scripts ] || exit 0
+
+. /etc/default/eeepc-acpi-scripts
+. /usr/share/eeepc-acpi-scripts/functions.sh
+. /etc/acpi/lib/notify.sh
+action=$1
+
+usage() {
+ cat <<EOF >&2
+Usage: $0 up|down|toggle
+EOF
+ exit 1
+}
+
+AMIXER=/usr/bin/amixer
+
+if ! [ -x $AMIXER ]; then
+ echo "$AMIXER not available" >&2
+ exit 1
+fi
+
+show_muteness() {
+ status=$($AMIXER get $VOLUME_LABEL | sed -n '/%/{s/.*\[\(on\|off\)\].*/\u\1/p;q}')
+ notify audio "Audio $status"
+}
+
+show_volume() {
+ percent=$($AMIXER get $VOLUME_LABEL | sed -n '/%/{s/.*\[\(.*\)%\].*/\1/p;q}')
+ notify audio "Volume $percent"
+}
+
+case "$action" in
+ toggle)
+ # muting $VOLUME_LABEL affects the headphone jack but not the speakers
+ $AMIXER -q set $VOLUME_LABEL toggle
+ # muting $HEADPHONE_LABEL affects the speakers but not the headphone jack
+ $AMIXER -q set $HEADPHONE_LABEL toggle
+ show_muteness
+ ;;
+ down)
+ amixer -q set $VOLUME_LABEL 2- unmute
+ amixer -q set $HEADPHONE_LABEL unmute
+ show_volume
+ ;;
+ up)
+ amixer -q set $VOLUME_LABEL 2+ unmute
+ amixer -q set $HEADPHONE_LABEL unmute
+ show_volume
+ ;;
+ *)
+ usage
+ ;;
+esac
--
Maintenance of eeepc-acpi-scripts debian package
More information about the Debian-eeepc-devel
mailing list