[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to detect which user is connected to $DISPLAY

On Fri, Mar 25, 2005 at 10:08:48PM +0100, Michelle Konzack wrote:
> My Problem is, HOW to find the $USER who is connected to a $DISPLAY.

i have a small shell function that does this in a project i'm working on.
this isn't the least hackish way of doing it, but here goes:

get_desktop_owner () 
	w | awk '{print $1" "$2}' | grep "$owner_display$" | awk '{print $1}'


copelandia[~]07:29:50$ get_desktop_owner :0

i invite someone to invent a better way, i'd like to hear it :)



Attachment: signature.asc
Description: Digital signature

Reply to: