summaryrefslogtreecommitdiff
path: root/sysutils/consolekit/files/ck-get-x11-display-device
diff options
context:
space:
mode:
authorJoe Marcus Clarke <marcus@FreeBSD.org>2010-07-24 02:14:15 +0000
committerJoe Marcus Clarke <marcus@FreeBSD.org>2010-07-24 02:14:15 +0000
commite573952843e97c4460eb7376c2c5036c99e9c21f (patch)
tree775def1f648ef50deebaab595ed63d6880a82fc3 /sysutils/consolekit/files/ck-get-x11-display-device
parentUpdate to 1.0.3 (diff)
Allow ConsoleKit to mark X sessions started with startx as active. This
will fix a lot of problems with delays starting GNOME applications, permission problems mounting removable media, and problems not being able to shutdown or reboot. Reported by: many
Notes
Notes: svn path=/head/; revision=258123
Diffstat (limited to 'sysutils/consolekit/files/ck-get-x11-display-device')
-rw-r--r--sysutils/consolekit/files/ck-get-x11-display-device12
1 files changed, 9 insertions, 3 deletions
diff --git a/sysutils/consolekit/files/ck-get-x11-display-device b/sysutils/consolekit/files/ck-get-x11-display-device
index 6fc508360b92..7efc08471660 100644
--- a/sysutils/consolekit/files/ck-get-x11-display-device
+++ b/sysutils/consolekit/files/ck-get-x11-display-device
@@ -5,7 +5,6 @@ GREP="/usr/bin/grep"
AWK="/usr/bin/awk"
SED="/usr/bin/sed"
CAT="/bin/cat"
-HEAD="/usr/bin/head"
dispnum=0
if [ x"$1" = x"--display" ]; then
@@ -25,11 +24,18 @@ if [ ! -f "/tmp/.X${dispnum}-lock" ]; then
fi
pid=$(${CAT} "/tmp/.X${dispnum}-lock")
-device=$(${FSTAT} -p ${pid} | ${GREP} ttyv | ${HEAD} -1 | ${AWK} '{print $8}')
+device=$(${FSTAT} -p ${pid} | ${GREP} ttyv | ${AWK} '{print $8}')
if [ -z "${device}" ]; then
echo "ERROR: Failed to find TTY device for X server on display ${dispnum}"
exit 1
fi
-echo "/dev/${device}"
+ret=""
+for dev in ${device}; do
+ if [ "${dev}" \> "${ret}" ]; then
+ ret=${dev}
+ fi
+done
+
+echo "/dev/${dev}"