[Debian-eeepc-commits] [SCM] Maintenance of eeepc-acpi-scripts debian package branch, master, updated. 1.1.5-88-g654c21e
Luca Niccoli
lultimouomo at gmail.com
Fri Nov 26 17:20:58 UTC 2010
The following commit has been merged in the master branch:
commit 654c21ece23e8876deb680fa5eda3a9d3da0cf55
Author: Luca Niccoli <lultimouomo at gmail.com>
Date: Fri Nov 26 18:19:57 2010 +0100
use getXconsole from acpi-support and remove detect_x_display
Signed-off-by: Luca Niccoli <lultimouomo at gmail.com>
diff --git a/acpilib/functions.sh b/acpilib/functions.sh
index 8b90a61..50880bf 100644
--- a/acpilib/functions.sh
+++ b/acpilib/functions.sh
@@ -1,5 +1,7 @@
# common eeepc-acpi-scripts functions
+. /usr/share/acpi-support/power-funcs
+
# detect which rfkill has name=$1
have_dev_rfkill()
{
@@ -59,38 +61,6 @@ else # we have no /dev/rfkill
}
fi
-detect_x_display()
-{
- local _user
- local _home
- _user=$(who | sed -n '/ (:0[\.0]*)$\| :0 /{s/ .*//p;q}')
- if [ "$_user" = "" ]; then
- # no users seem to be logged on a X display?
- # try the first logged user without any filters
- # useful for users starting X via 'startx' after logging
- # on the console
- #_user=$( who | head -n 1 | cut -d' ' -f1 )
- _user=$(ps -o pid= -t tty$(fgconsole) | sed -e 's/^\s\+//g' | cut -d' ' -f1)
- if [ "${_user}" != '' ]; then
- eval $(sed -e 's/\x00/\n/g' /proc/${_user}/environ | grep '^\(DISPLAY\|XAUTHORITY\)=' | sed -e "s/'/'\\\\''/g; s/=/='/; s/$/'/")
- DISPLAY="${DISPLAY:-:0}"
- export XAUTHORITY
- export DISPLAY
- user=root
- home=$(getent passwd $_user | cut -d: -f6)
- fi
- return
- fi
- _home=$(getent passwd $_user | cut -d: -f6)
- XAUTHORITY=$_home/.Xauthority
- if [ -f "$XAUTHORITY" ]; then
- export XAUTHORITY
- export DISPLAY=:0
- user=$_user
- home=$_home
- fi
-}
-
shell_quote()
{
echo "$1" | sed -e 's/'\''/'\''\\'\'''\''/g; s/^/'\''/; s/$/'\''/; $! s/$/\\/'
@@ -100,7 +70,7 @@ lock_x_screen()
{
# activate screensaver if available
if [ -S /tmp/.X11-unix/X0 ]; then
- detect_x_display
+ getXconsole
if [ -f "$XAUTHORITY" ]; then
for ss in xscreensaver gnome-screensaver; do
[ -x /usr/bin/$ss-command ] \
diff --git a/acpilib/notify.sh b/acpilib/notify.sh
index 88cba84..e97e596 100644
--- a/acpilib/notify.sh
+++ b/acpilib/notify.sh
@@ -2,7 +2,6 @@
#
# this file is to be sourced
-. /usr/share/acpi-support/power-funcs
notify() {
CATEGORY=$1
MSG=$2
diff --git a/acpilib/touchpad.sh b/acpilib/touchpad.sh
index b882d8b..b87a169 100644
--- a/acpilib/touchpad.sh
+++ b/acpilib/touchpad.sh
@@ -2,7 +2,7 @@
#
# to be sourced
-detect_x_display
+getXconsole
toggle_touchpad()
{
diff --git a/eeepc-acpi-scripts/hotkey.sh b/eeepc-acpi-scripts/hotkey.sh
index 199a289..c09861c 100755
--- a/eeepc-acpi-scripts/hotkey.sh
+++ b/eeepc-acpi-scripts/hotkey.sh
@@ -41,7 +41,7 @@ handle_volume_down() {
handle_blank_screen() {
if [ -S /tmp/.X11-unix/X0 ]; then
- detect_x_display
+ getXconsole
if [ -n "$XAUTHORITY" ]; then
xset dpms force off
diff --git a/eeepc-acpi-scripts/vga-toggle.sh b/eeepc-acpi-scripts/vga-toggle.sh
index 9df938b..d2fd389 100755
--- a/eeepc-acpi-scripts/vga-toggle.sh
+++ b/eeepc-acpi-scripts/vga-toggle.sh
@@ -32,7 +32,7 @@ getvga_status(){
esac
}
-detect_x_display
+getXconsole
getvga_status;
# handle return value
case $? in
--
Maintenance of eeepc-acpi-scripts debian package
More information about the Debian-eeepc-commits
mailing list