[comp.sys.sun] Popup window version of rwall

hiebeler@turing.cs.rpi.edu (Dave Hiebeler) (03/07/89)

In article <8902142213.AA00947@icarus> you write:
>...I'd like to be able to send a message to all of the active clients
>that would be displayed in a popup window with a "Done" box on top of all
>other existing windows. Has anyone done anything like this? Any pointers
>to easily modified code to do something like this? 

One way to do this (other than making everyone use contool, as wnl pointed
out) might be to put the SunView escape-sequences that raise and resize a
window into the broadcast message.  That is, put in the character sequence
that raises the window on top of all others, and perhaps resize it to be a
full-screen window.  (Resizing it would be somewhat obnoxious, but
probably preferable to them not knowing that the fileserver is about to go
away).

I don't know if rwall would filter out those characters; it might be worth
a shot though.  The escape-character sequences are described in the
shelltool man-page.

----
Dave Hiebeler             Internet: hiebeler@cs.rpi.edu  (preferred address)
Computer Science Dept.            hiebeler%cs.rpi.edu@itsgw.rpi.edu
Amos Eaton Bldg.            Bitnet: userfrzk@rpitsmts.bitnet
Rensselaer Polytechnic Inst.
Troy, NY 12180-3590

[[ But what would they do to plain-jane terminals?  Remember the extent of
an "rwall".  --wnl ]]

mmm%informatics.rutherford.ac.uk@nss.cs.ucl.ac.uk (03/15/89)

in Sun-Spots Digest, v7n163
 David C. Kovar <daedalus!corwin@talcott.harvard.edu> writes
> Our users ... happily ignore the beeps
> indicating that a console message has arrived...
> Something that works along these lines is Chuck Musciano's "contool".
> ... --wnl

I always like to try to solve problems with shell scripts rather than
programs:  they are usually much easier to adapt to people's particular
wishes, are shorter and therefore more likely to be read, and on today's
machines don't need to be a performance bottleneck.  Instead of "contool"
I use the following script in the shelltool or cmdtool I want to be my
console, started with, eg:

  cmdtool -Wp 399 0 -Ws 668 554 -WP 1088 0 -Wi sh -c "stamp;exec sh"

The script will time-stamp messages appearing on the console, and can ring
the bell and pop up and open the window as well (suppressed to not more
than once a minute in the example below).  It can ignore messages matching
patterns, such as is done with /[Ss]tarting [Dd]umps/.  It uses dd to read
the input since sh's read doesn't cope too well.  Make sure the 3
non-printing characters ^g ^[ ^m get through the mailers.  Startup is a
little slow due to the TIOCCONS needed.
---------------cut here for stamp------------------
#!/bin/sh
# console listener and timestamp. Mark Martin June 1988 RAL
# the following  are: bell='^g' esc='^[' carriagereturn='^m'
bell='' esc='' carriagereturn='
becomeconsole=/tmp/makecon$$ parent=$$
open=${esc}'[1t' pop=${esc}'[5t' pagemodeoff=${esc}'[>1l'
endtext=${esc}'\'
iconlabel=${esc}']L'		# add endtext

dateformat='%a %H:%M '
notify="$bell$open$pop$pagemodeoff"

trap 'rm -f $becomeconsole.c $becomeconsole; exit 1' 0 1 2 3 15
echo '#include <sys/ioctl.h>
main(){
	if(ioctl(1,TIOCCONS,0)<0)exit(1);
	exit(0);
}' >$beconsole.c
nice -9 cc $beconsole.c -s -o $beconsole
rm $beconsole.c

for m in p q r
do
for n in 0 1 2 3 4 5 6 7 8 9 a b c d e f
do	master="/dev/pty$m$n"
	slave="/dev/tty$m$n"
	(
	if	$beconsole
	then	echo "using $slave" >/dev/console
		rm $beconsole
		kill -9 $parent
		while	line=`dd count=1 bs=4k 2>/dev/null`
		do	stamp=`date "+$dateformat"`
			if [ "$stamp" = "$laststamp" ]
			then	note=
			else	note=$notify
				laststamp=$stamp
			fi
			echo "$line" | sed '
			s/'"$bell"'//g
			s/'"$carriagereturn"'//g
			/[Ss]tarting [Dd]umps/b stamp
			/^[	 *]*$/d
			s/$/'"$note"'/
			:stamp
			s/[a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z ][a-zA-Z ][a-zA-Z ]/&'"$iconlabel&$endtext"'\/
			s/^/'"$stamp"'/
			' 1>&2
		done
	fi <$master 2>&1 >$slave
	) 2>/dev/null
done
done

Mark M Martin			janet:	mmm@uk.ac.rl.inf
Informatics			arpa:	mmm%inf.rl.ac.uk@nss.cs.ucl.ac.uk
Rutherford Appleton Lab		uucp:	..!mcvax!ukc!rlinf!mmm
Didcot, Oxon, UK. OX11 0QX		mmm@rlinf.uucp
Tel +44 235 44 5160		Fax +44 235 44 5831

jdiaz@oracle.com (Jean Marie Diaz) (04/19/89)

>   From: steinmetz!sprite!montnaro@uunet.uu.net (Skip Montanaro)
>   Original-Date: Wed, 8 Mar 89 09:44:43 EST
>
>   Instead of the rwall user having to stick that stuff in though, I think
>   rwalld should be modified to realize what type of environment is being run
>   on each login session to which it will write messages. [...]
>
>   Is this bizarre, or what?

Yup, it's bizarre.  It also seems to be the wrong place to put such code.
After all, once you've finished rwalld, it'd be nice to have the same
capabilities in talk... and write... and biff... and any other application
that wants to notify you of events.

So, it seems that the right thing to do would be to write a notification
service, with a server that keeps track of where you are, and what kinds
of messages you want to see, and a client that shows the messages to you
using whatever window system you're using, and an interface to allow
applications to send messages, and....

Fortunately, it's already been written.  A paper on the Zephyr
Notification Service was published in the Winter '88 Usenix proceedings.
For more information, send mail to zephyr@athena.mit.edu.  (Not to me!)

Claimer:  I am merely a happy Zephyr user.


				   AMBAR
ambar@oracle.com				 {uunet,pyramid}!oracle!ambar