[K12OSN] Screen Pop - Howto?

Julius Szelagiewicz julius at turtle.com
Tue Sep 1 21:30:41 UTC 2009

On Tue, 1 Sep 2009, C. Duncan Hudson wrote:

> Currently the cameras just write an image to a directory on the ltsp
> server when a customer is detected (IR beam broken).  I could do
> something else with the image...  whatever makes things easiest.
> Dunc
> Julius Szelagiewicz wrote:
> > there are several ways to "pop" a picture on the user's screen.
> > You can have an user app waiting for picture showing up in a preset place
> > - that can be run from .bash_profile. You can have a single app waiting
> > and displaying the pic on all terminals - for that you need a list of
> > current DISPLAY variables (I use the single app approach). It is
> > surprisingly easy. How does the picture appear on the system? How would an
> > app know about it?
> > julius
OK, from the top of my head:
0. make file /var/tmp/users , permissions 666
1. add this to .bash_profile:
echo $USER      $DISPLAY        $HOSTNAME >> /var/tmp/users
xhost +
2. make a script checking for new picture, say, every 3 seconds
while [ 1 -gt 0 ]
available=$(ls PICDEIRECTORY|wc -l)
if [ $available -gt 0 ]
rm -f whereiwanthemdirectory/*
mv PICDIRECTORY/* whereiwantthemdirectory
users=$(who|cut -d " " -f1)
for user in $users
display=`grep ^"$1 " /var/tmp/users | tail -1 | cut -d " " -f 2`
gthumb --display=$display whereiwantthemdirectory/*
sleep 3
3. have a well deserved beer

There are nicer ways to script, but this should work fine. The good - one
process waiting, the bad - xhost +

Off the top of my head, ymmv.

More information about the K12OSN mailing list