Setting up windows on login

Rob Warnock rpw3 at rigden.wpd.sgi.com
Fri May 10 22:19:37 AEST 1991


In article <BROWNING.91May1181117 at ew10.nas.nasa.gov>
browning at nas.nasa.gov (David S. Browning) writes:
+---------------
| There's a related question:  Once you've layed (lied?) out your
| windows, it would be nice to save the layout (e.g. sizes, positions,
| fonts) in a way that could be used again upon startup.  Something like
| "tooplaces > ~/.suntools" on a Sun before X.  With X, at least you
| have "xwininfo" which gives you position info, which you can then
| transcribe to the appropriate startup file.  NeWS on the IRIS has no
| such analog that I know of.  (I've asked about this before on
| comp.sys.sgi.)
+---------------

And it's been answered before -- several times -- but here it is again,
attached below. [Anybody out there building an SGI FAQ? Please add this
item...] Just clip at the "===" lines, save as "showpref" somewhere in your
path, make it executable (chmod +x), and run to get the close equivalent of
"xlswins -l":

	% showpref
	(xclock) 20 232 140 140 makepreference
	(rigden) 180 100 745 780 makepreference
	(rigden) 525 20 745 312 makepreference
	(rigden) 340 200 745 780 makepreference
	(console) 20 20 745 104 makepreference
	(mailbox) 140 924 preforigin
	(mouseXY) 20 420 140 67 makepreference
	(sysmeter) 20 535 107 194 makepreference
	(rigden) 260 150 745 780 makepreference

For those things of which you have only one on the screen (e.g., mailbox),
you can just copy the "makepreference" or "preforigin" line into your user.ps,
but for multiple copies (e.g., those "rigden"s above, which are really "wsh"s)
you'll have to convert the positions to run commands (PostScript "forkunix"
or "forkwsh") by hand. At least it gives you the exact pixel positions of
where everything is on the screen...

I prefer to save all this stuff in a separate file "desktop.ps", which is
called from my user.ps, and which has all the (non-toolchest) windows you
want to pop up on login. For example, using the above output, I constructed
the following:

	#! /usr/sbin/psh
	/forkwsh { % args => -
		(wsh -n "`hostname -s`" -t "$LOGNAME@`hostname -s`" )
		(-r1000 -fIris.10 -C0,164,4,7 )
		append exch append
		forkunix
	} def

	% keep these here, rather than in prefs.ps, so can change in one place
	(mailbox) 140 924 preforigin
	(mouseXY) 20 420 140 67 makepreference

	(mailbox -s 65 -m 'exec wsh -n mail -Z1 -s60x80 -fIris.10 -C0,15,4,7 \
		-p 180,200 -m70x132 -c /usr/sbin/Mail') forkunix
	(sysmeter -s 1 -d 60 -x 20 -y 535 -g 30 -r 4 -v cpu pkts disk page)
		forkunix
	(mouseXY) forkunix

	(525,20) (-m 70x132 -s 24x80 -p ) exch append forkwsh
	(340,200) (-m 70x132 -s 60x80 -p ) exch append forkwsh
	(260,150) (-m 70x132 -s 60x80 -p ) exch append forkwsh
	(180,100) (-m 70x132 -s 60x80 -p ) exch append forkwsh

The last four lines are what generated the four "rigden" shell windows
[the "console" was started in user.ps].

To change your layout, open new windows, move stuff around as you like, and
run "showpref" again. Then edit your "desktop.ps" (or whatever you use) to
correspond to the new numbers.

[Disclaimer: I didn't write "showpref", though I did hack on it a little.
A long line of SGI employees (who may or may not want to remain nameless)
led me to this tool.]


-Rob

-----
Rob Warnock, MS-1L/515		rpw3 at sgi.com		rpw3 at pei.com
Silicon Graphics, Inc.		(415)335-1673		Protocol Engines, Inc.
2011 N. Shoreline Blvd.
Mountain View, CA  94039-7311

======== attachment: showpref ==============================
#! /bin/sh
FILE=/tmp/showpref.$$
psh << EOF
systemdict begin
/out ($FILE) (w) file def
/UsableName (xx) def
/printpref {
    PortName dup (no name) eq {
	pop IconLabel
    } if /UsableName exch store
    ClientCanvas /GLCanvas get {
	gsave framebuffer setcanvas
	    out
	    HavePrefSize? {
		((%) % % preforigin\n)
		    [ UsableName				% portname
			ClientCanvas getcanvaslocation 	% pn x y
			xfc mul round exch
			xfc mul round exch
		    ]
	    } {
		((%) % % % % makepreference\n)
		    [ UsableName 				% portname
			ClientCanvas dup getcanvaslocation % pn cv x y
			3 -1 roll setcanvas		% pn x y
			clippath pathbbox		% pn x y lf bt rg tp
			points2rect			% pn x y llx lly w h
			4 2 roll pop pop		% pn x y w h
			xfc mul round 4 1 roll
			xfc mul round 4 1 roll
			xfc mul round 4 1 roll
			xfc mul round 4 1 roll
		    ]
	    } ifelse
	    fprintf
	grestore
    } {
	out ((%) % % % % makepreference\n)
	    [ UsableName FrameX FrameY FrameWidth FrameHeight ] fprintf
    } ifelse
} def

{ printpref } AllWin
1 1 100 { pause } for
out flushfile
currentdict dup dup /out undef /printpref undef /UsableName undef
end
EOF
cat $FILE
rm $FILE



More information about the Comp.sys.sgi mailing list