[email protected] wrote (17 Feb 2009 17:57:42 GMT) :
> The attached patch achieves so

... well, the previous patch is buggy, please consider the fixed one
attached to this very email instead.

Bye,
--
   <[email protected]>
  | gnupg key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc
  | Who wants a world in which the guarantee that we shall not
  | die of starvation would entail the risk of dying of boredom ?

>From 4505e790e558c990545f86afd06e9913db3705ca Mon Sep 17 00:00:00 2001
From: intrigeri <[email protected]>
Date: Tue, 17 Feb 2009 18:39:36 +0100
Subject: [PATCH] /etc/acpi/videobtn.sh: optionally run a graphical UI to RandR

... if USE_RANDR_UI is enabled in /etc/default/acpi-support. Unless the
preferred UI software is configured in /etc/default/acpi-support, a sensible one
is guessed at runtime.
---
 acpi-support     |    7 +++++++
 debian/changelog |    9 +++++++++
 videobtn.sh      |   22 +++++++++++++++++++++-
 3 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/acpi-support b/acpi-support
index e6faffb..b176a98 100644
--- a/acpi-support
+++ b/acpi-support
@@ -138,6 +138,13 @@ RESTART_IRDA=false
 # a prefix given in this list is skipped)
 SKIP_INTERFACES="dummy qemu"
 
+# Uncomment this line to have a RandR GUI run when the video button is pressed
+# USE_RANDR_UI=true
+
+# Path to your preferred RandR graphical frontend - guessed if not specified
+# RANDR_UI=/usr/bin/grandr
+
+
 # Note: to enable "laptop mode" (to spin down your hard drive for longer
 # periods of time), install the laptop-mode-tools package and configure
 # it in /etc/laptop-mode/laptop-mode.conf. 
diff --git a/debian/changelog b/debian/changelog
index efddd5e..7861c3c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+acpi-support (0.109-11+intri2) unstable; urgency=low
+
+  * /etc/acpi/videobtn.sh: run a graphical UI to RandR if USE_RANDR_UI is
+    enabled in /etc/default/acpi-support. Unless the preferred UI software
+    is configured in /etc/default/acpi-support, a sensible one is guessed
+    at runtime.
+
+ -- intrigeri <[email protected]>  Tue, 17 Feb 2009 18:24:49 +0100
+
 acpi-support (0.109-11+intri1) unstable; urgency=low
 
   * /etc/acpi/events/ibm-videobtn: run /etc/acpi/videobtn.sh, as do
diff --git a/videobtn.sh b/videobtn.sh
index ab5e548..c4fa4c2 100644
--- a/videobtn.sh
+++ b/videobtn.sh
@@ -1,5 +1,25 @@
 #!/bin/sh
 [ -f /usr/share/acpi-support/key-constants ] || exit 0
 
+. /etc/default/acpi-support
 . /usr/share/acpi-support/key-constants
-acpi_fakekey $KEY_VIDEOOUT
+. /usr/share/acpi-support/power-funcs
+
+if [ "$USE_RANDR_UI" = true ]; then
+   getXconsole;
+   if [ x"$XAUTHORITY" != x"" ]; then
+      export DISPLAY=":$displaynum"
+      if [ -z "$RANDR_UI" ]; then
+	 if [ -x /usr/bin/grandr ]; then
+	    RANDR_UI=/usr/bin/grandr
+	 elif [ -x /usr/bin/arandr ]; then
+	    RANDR_UI=/usr/bin/arandr
+	 fi
+      fi
+      if [ -n "$RANDR_UI" -a -x "$RANDR_UI" ]; then
+	 su $XUSER -c "$RANDR_UI"
+      fi
+   fi
+else
+   acpi_fakekey $KEY_VIDEOOUT
+fi
-- 
1.5.6.5

Reply via email to