-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

I'm using Gnome on my 901 and I find the way eeepc-acpi-scripts
currently handle volume hotkeys (by directly changing mixer settings
through Alsa) a bit in contradiction with the ways of a modern Linux
Desktop.

This is a patch that will leave volume changes to gnome-settings-daemon.
If a running g-s-d is detected, the script only invokes acpi_fakekey to
communicate a volume up/down/mute event down the stack. The benefits are
 that you get the nice stock Gnome volume meter on pressing those hot
keys, like on most other laptops. If g-s-d is not running, amixer is
invoked as before.

Unfortunately, acpi_fakekey and /usr/share/acpi-support/key-constants is
currently in acpi-support package, which conflicts with
eeepc-acpi-scripts. This problem could be fixed by moving these two
files to acpi-support-base.

Best regards
Tomaž


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAklEB1sACgkQsAlAlRhL9q/6xQCeIdE4IB1tfqKEVVPdBkJoXrj4
Gv8An3YB1IQCUyloyq1dAfnjAhXz5Zdc
=C61r
-----END PGP SIGNATURE-----
>From 41144979a8492ce215b530b479a130df8429db6f Mon Sep 17 00:00:00 2001
From: Tomaz Solc <[email protected]>
Date: Sat, 13 Dec 2008 18:23:52 +0100
Subject: [PATCH] Can leave volume handling to desktop environment

If gnome-settings-daemon is running or if user has specifically
requested this in /etc/defaults/eeepc-acpi-scripts, events generated
by volume hotkeys are simply translated to proper key presses
with acpi_fakekey.

Note that this requires acpi_fakekey tool and
/usr/share/acpi-support/key-constants to be present on the system.
---
 debian/README.Debian       |    3 ++
 etc/acpi/actions/volume.sh |   48 +++++++++++++++++++++++++++++++++----------
 2 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/debian/README.Debian b/debian/README.Debian
index 69007cf..9e766aa 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -12,6 +12,9 @@ package, we still search a sane solution for this. To get the correct values
 for these labels check the output of "amixer". On some Eee PC's the correct
 values are 'Front' and 'Headphone'.
 
+If you want to leave volume management to any desktop environment you might
+be running, set HANDLE_VOLUME to 0.
+
 To get nifty osd overlays on changing the volume, switching on wireless
 etc. change ENABLE_OSD to yes in /etc/default/eeepc-acpi-scripts. Make sure you
 have aosd-cat installed then.
diff --git a/etc/acpi/actions/volume.sh b/etc/acpi/actions/volume.sh
index 904d71d..5a4d620 100755
--- a/etc/acpi/actions/volume.sh
+++ b/etc/acpi/actions/volume.sh
@@ -13,6 +13,18 @@ if [ -e "$DEFAULT" ]; then . "$DEFAULT"; fi
 . /etc/acpi/lib/notify.sh
 action=$1
 
+if [ ! "$HANDLE_VOLUME" ]; then
+	if pidof gnome-settings-daemon > /dev/null; then
+		HANDLE_VOLUME="0"
+	else
+		HANDLE_VOLUME="1"
+	fi
+fi
+
+if [ "$HANDLE_VOLUME" = "0" ]; then
+	. "/usr/share/acpi-support/key-constants"
+fi
+   
 usage() {
     cat <<EOF >&2
 Usage: $0 up|down|toggle
@@ -39,21 +51,35 @@ show_volume() {
 
 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
+	if [ "$HANDLE_VOLUME" = "1" ]; then
+        	# 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
+	else
+		acpi_fakekey $KEY_MUTE
+	fi
         ;;
     down)
-        amixer -q set $VOLUME_LABEL 2- unmute
-        amixer -q set $HEADPHONE_LABEL unmute
-        show_volume
+	if [ "$HANDLE_VOLUME" = "1" ]; then
+        	amixer -q set $VOLUME_LABEL 2- unmute
+	        amixer -q set $HEADPHONE_LABEL unmute
+       		show_volume
+	else
+		acpi_fakekey $KEY_VOLUMEDOWN
+	fi
         ;;
     up)
-        amixer -q set $VOLUME_LABEL 2+ unmute
-        amixer -q set $HEADPHONE_LABEL unmute
-        show_volume
+	if [ "$HANDLE_VOLUME" = "1" ]; then
+        	amixer -q set $VOLUME_LABEL 2+ unmute
+	        amixer -q set $HEADPHONE_LABEL unmute
+	        show_volume
+	else
+		acpi_fakekey $KEY_VOLUMEUP
+	fi
         ;;
     *)
         usage
-- 
1.5.6.5


_______________________________________________
Debian-eeepc-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/debian-eeepc-devel

Reply via email to