determine a display used by gnome-session
Staszek Hodur
staho at os.pl
Sun Jan 1 20:36:04 UTC 2012
/proc/PID/environ is it! And notify-send is a good hint.
Thank you very much. :-)
__
Stanislas Hodur
Dnia sob, 31 gru 2011, 16:08:00 Jeff Hanson pisze:
> On Sat, Dec 31, 2011 at 9:51 AM, Jeff Hanson<jhansonxi at gmail.com> wrote:
>> I suggest using notify-send as root to send the message unless you
>> need to check some kind of response from the user.
>
> Here is a bit of code I use:
> for xttypid in $(ps a o pid= o tty= | sed -n
> 's/^\([[:space:]]*\)\([[:digit:]]\+\)\([[:space:]]tty[[:digit:]]\+\)$/\2/p');
> do
> export DISPLAY=$(sed -n
> 's/\(.*[^[:alpha:]]*DISPLAY=\+\)\(:[[:digit:]]\+\)\(.*\)/\2/p'
> /proc/$xttypid/environ)
> /usr/bin/notify-send \
> --urgency="$1" \
> --category="$2" \
> --icon="$3" \
> --expire-time="$4" \
> "$5" "$6" 2>/dev/null
> done
>
------
Tanie domeny - http://www.adresik.pl
More information about the Ubuntu-devel-discuss
mailing list