[comp.sys.sgi] Setting up windows on login

eesnyder@boulder.Colorado.EDU (Eric E. Snyder) (04/26/91)

This is probably an easy question but, be nice, I am a biologist...:-).

I have an SGI Iris 4D and would like to know how to set up windows
automatically when I log in.  I am a little familiar with doing this
on an X-windows system but there do not seem to be the equivalent
.xsession, etc. files on the Iris.  Any pointers would be appreciated.
I have a full set of manuals and just need to be pointed in the 
right direction.  

Thanks!

...and thanks again to everyone who replied re: Iris .gif viewers...

---------------------------------------------------------------------------
TTGATTGCTAAACACTGGGCGGCGAATCAGGGTTGGGATCTGAACAAAGACGGTCAGATTCAGTTCGTACTGCTG
Eric E. Snyder                            
Department of MCD Biology              ...making feet for childrens' shoes.
University of Colorado, Boulder   
Boulder, Colorado 80309-0347
LeuIleAlaLysHisTrpAlaAlaAsnGlnGlyTrpAspLeuAsnLysAspGlyGlnIleGlnPheValLeuLeu
---------------------------------------------------------------------------

dwagon@monu6.cc.monash.edu.au (Zer Dwagon) (05/01/91)

eesnyder@boulder.Colorado.EDU (Eric E. Snyder) writes:

>This is probably an easy question but, be nice, I am a biologist...:-).

>I have an SGI Iris 4D and would like to know how to set up windows
>automatically when I log in.  I am a little familiar with doing this
>on an X-windows system but there do not seem to be the equivalent
>.xsession, etc. files on the Iris.  Any pointers would be appreciated.
>I have a full set of manuals and just need to be pointed in the 
>right direction.  

>Thanks!

>...and thanks again to everyone who replied re: Iris .gif viewers...

The way I do it is to have in my .login something like the following:

if( ${OPSYS} == "irix" ) then
	if( `tty` == "/dev/console" ) then
		wsh -f Screen10 -m 140,67 -p 10,10 -E -s 80,63 -t SGI -c /edp/edp/edp328j/bin.irix/tcsh
		wsh -f Screen10 -v -m 140,67 -p 695,350 -E -s 67,40 -t Pyramid -c /usr/bsd/rlogin monu6
		wsh -f Screen10 -m 140,67 -p 695,10 -E -s 67,20 -t SGI -c /edp/edp/edp328j/bin.irix/tcsh
	endif
endif

which checks to see that I am logged into the console, and then forks off
three windows, and runs the shells I like in each of them, including rloging
into our main machine here.

Hope that helps.
-- 
Dougal Scott  - dwagon@monu6.cc.monash.edu.au  Faculty of Computing & Info Tech
Hell hath no fury like a woman born.               Monash University, Caulfield
                             -Admiral Korg                  Victoria, AUSTRALIA 

browning@nas.nasa.gov (David S. Browning) (05/02/91)

In article <1991May1.024109.26761@monu6.cc.monash.edu.au> dwagon@monu6.cc.monash.edu.au (Zer Dwagon) writes:

   The way I do it is to have in my .login something like the following:

   if( ${OPSYS} == "irix" ) then
	   if( `tty` == "/dev/console" ) then
		   wsh -f Screen10 -m 140,67 -p 10,10 -E -s 80,63 -t SGI -c /edp/edp/edp328j/bin.irix/tcsh
		   wsh -f Screen10 -v -m 140,67 -p 695,350 -E -s 67,40 -t Pyramid -c /usr/bsd/rlogin monu6
		   wsh -f Screen10 -m 140,67 -p 695,10 -E -s 67,20 -t SGI -c /edp/edp/edp328j/bin.irix/tcsh
	   endif
   endif

   which checks to see that I am logged into the console, and then forks off
   three windows, and runs the shells I like in each of them, including rloging
   into our main machine here.

   Hope that helps.

Umm, shouldn't this be done in user.ps?

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.)  There's no way to get position info from a window that
you've moved by hand with the mouse.  I find this a serious
shortcoming, making customization painful. (Until it's finally right!)

I CANNOT WAIT until X runs fast enough on this IRIS (4D/60, IRIX 3.3).

David

--
|============================================================================|
| Internet:  browning@nas.nasa.gov                  Phone:  (415) 604-4321   |
| UUCP:  {hplabs, mailrus, ucbvax, etc.}!ames!amelia!browning                |
|----------------------------------------------------------------------------|
|"the nice thing about true hopelessness is that you don't have to try again"|
| -- jules shear                                                             |
|============================================================================|

Dan Karron@UCBVAX.BERKELEY.EDU (05/02/91)

>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.)  There's no way to get position info from a window that
>you've moved by hand with the mouse.  I find this a serious
>shortcoming, making customization painful. (Until it's finally right!)
>
>|============================================================================|
>| Internet:  browning@nas.nasa.gov                  Phone:  (415) 604-4321   |
>| UUCP:  {hplabs, mailrus, ucbvax, etc.}!ames!amelia!browning                |
>|----------------------------------------------------------------------------|
>|"the nice thing about true hopelessness is that you don't have to try again"|
>| -- jules shear                                                             |
>|============================================================================|

Till X is here and now, I have some hacks for the 4sight window manager
I call 'Stickey Windows'. Essentially, the idea is that every window 
attempts to read its place from a settings file, and when you exit or kill
a window, it will save its place in a settings file. The settings file
are the window title name , e.g., winopen("bingo") preappended with a .W
".Wbingo".

I use this with multi threaded graphics applications with lots of mains and
windows. Once you lay out your screen the way you like, every time you startup
you application the windows open up where you want them to.

The code uses macros to replace the gl calls with private calls that
intercept window manager calls and keeps a linked list of window properties.

I find it really useful for such a simple idea, and think that it should
be made an optional part of the gl source. I disable/enable this feature with
an environment var "SAVE_WINDOW_LAYOUT". The source is on my anon ftp as
StickeyWindows.tar.Z.

Sorry, this works only for source code ! 


Cheers!

dan.
| karron@nyu.edu (e-mail alias )         Dan Karron, Research Associate      |
| Phone: 212 263 5210 Fax: 212 263 7190  New York University Medical Center  |
| 560 First Avenue                       Digital Pager <1> (212) 397 9330    |
| New York, New York 10016               <2> 10896   <3> <your-number-here>  |

rpw3@rigden.wpd.sgi.com (Rob Warnock) (05/10/91)

In article <BROWNING.91May1181117@ew10.nas.nasa.gov>
browning@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@sgi.com		rpw3@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