-=| Darren Salt, Fri, Oct 24, 2008 at 12:35:43PM +0100 |=-
> I find that either the first method in detect_x_display() for finding a
> logged-in user succeeds or the second method also fails. This patch replaces
> the second method: rather than extract all logged-in users, look for a
> process which is using a console and has certain environment variables which
> then are used for OSD purposes. (The OSD will also work if a login manager is
> currently in control.)

-        _user=$( who | head -n 1 | cut -d' ' -f1 )
+        #_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

Looks good and the possibility to have OSD notifications before 
logging in would be very nice.

Shouldn't "user=root" actually be "user = $_user"? For example if 
X was started with "startx" from the console...

-- 
dam            JabberID: [EMAIL PROTECTED]

Attachment: signature.asc
Description: Digital signature

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

Reply via email to