Re: [gdm-list] custom display on gdmgreeter



Yes, that works, thanks for that Yan.

Though, it would be nice to be able to have something more robust - an icon that stays up (as opposed to a temporary notification message) as long as the operation is taking place and possibly even a progress bar.

If its not possible (as I alluded to earlier, I'm not averse to firing up my text editor and programming this myself as long as someone points me at the appropriate API), at least this is a good-enough fallback for me.

Thanks again,
Ishaaq

2009/4/6 Yan Seiner <yan seiner com>
Ishaaq Chandy wrote:
Good idea - but unfortunately that doesn't work unless you are logged in:

~$ export DISPLAY=:0
~$ notify-send "foo" "bar"
libnotify-Message: Unable to get session bus: dbus-launch failed to autolaunch D-Bus session: No protocol specified
Autolaunch error: X11 initialization failed.
Not that simple.  You need to get the session stuff.  I'm attaching a script I wrote that writes to arbitrary X sessions.

Not sure if that will word as-is, but if you look at the end you'll see how I handle the authentication.

--Yan


Ishaaq

2009/4/6 Yan Seiner <yan seiner com <mailto:yan seiner com>>


   Ishaaq Chandy wrote:

       Hi all,

       My wife uses an external USB hard-disk to maintain her photo
       gallery. She needed a simple way to backup this disk. I've
       setup one of my linux installs' udev configuration to detect
       when this particular disk gets connected to its USB port and
       then kicks off my custom script which mounts the drive, rsyncs
       her photo gallery to a backup disk and then unmounts the drive
       when done.

       This works beautifully, no hassles. The problem is, there is
       no feedback that this is happening, nor is there any
       indication when it is completed and the hard disk can be
       safely removed. I was wondering if there is some way I can
       hack into the gdm greeter for it to show up an icon (and
       possibly a progress bar - but that may be ambitious) when the
       disk is being rsynced.

       My wife isn't very computer savvy, which is why I want to make
       this very simple from her point of view. I on the other hand
       am not afraid to write some C/C++ to get this working. As long
       as someone can give me some pointers as to where to start.

       ... or tell me I'm barking up the wrong tree and that GDM
       can't do this.

   I don't know if notify-send works when gdm is running, but that
   would be a start.....

   --Yan

   --    Yan Seiner
   Support my bid for the 4J School Board.
   Visit http://www.seiner.com/schoolboard



!DSPAM:49d983b6274111061887518!
------------------------------------------------------------------------

_______________________________________________
gdm-list mailing list
gdm-list gnome org
http://mail.gnome.org/mailman/listinfo/gdm-list


!DSPAM:49d983b6274111061887518!
 


--
Yan Seiner
Support my bid for the 4J School Board.
Visit http://www.seiner.com/schoolboard



#!/bin/sh

USAGE="$0 -s summary -u user -t timeout -p priority -i icon -c category -h help -v version message"

pids=`pgrep '[gnome|xfce4|kde]-session'`

# title
# user
# timeout
# urgency
# icon
# category
# help
# version

line=''

while getopts s:u:m:t:p:c:i:hv OPT; do
   case "$OPT" in
       s)      title=$OPTARG ;;
       u)      user=$OPTARG
               pids=`pgrep -u $user '[gnome|xfce4|kde]-session' 2>/dev/null ` || exit 1
               ;;
       t)      timeout=$((OPTARG+0))
               line="$line -t $timeout"
               ;;
       p)      priority=$OPTARG
               line="$line -u $priority"
               ;;
       i)      icon="$OPTARG"
               line="$line -i \'$icon\'"
               ;;
       c)      category=$OPTARG
               line="$line -c $category"
               ;;
       h)      echo $USAGE
               exit 0
               ;;
       v)      echo "`basename $0` version 0.1"
               exit 0
               ;;
       \?)     # getopts issues an error message
               echo $USAGE >&2
               exit 1
               ;;
   esac
done

shift `expr $OPTIND - 1`

message=$@

if [ -z "$message" ]; then
#       echo $USAGE
       exit 1
fi
if [ -z "$timeout" ]; then
       line="$line -t 60000"
fi

for pid in $pids; do
       # find DBUS session bus for this session
       DBUS_SESSION_BUS_ADDRESS=`grep -z DBUS_SESSION_BUS_ADDRESS \
               /proc/$pid/environ | sed -e 's/DBUS_SESSION_BUS_ADDRESS=//'`
       UNAME=`grep -z USERNAME \
               /proc/$pid/environ | sed -e 's/USERNAME=//'`
       DISP=`grep -z DISPLAY \
               /proc/$pid/environ | sed -e 's/DISPLAY=//'`
       XAUTH=`grep -z XAUTHORITY \
               /proc/$pid/environ | sed -e 's/XAUTHORITY=//'`

       # use it
echo $line
       DISPLAY=$DISP DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS XAUTHORITY=$XAUTH \
       sudo -u $UNAME notify-send $line "$title" "$message"
done





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