Sunview Escape Sequences

Christopher North-Keys harp at TERRA.PKG.MCC.COM
Tue Nov 28 08:40:53 AEST 1989


(Disclaimer:  I no longer use Sunview, as I find X to be more flexible and
far more secure.)

I recently saw a request for a way to write labels onto icons dynamically.
The following is a list of the C-shell aliases compiled by the talisman
group at the University of Texas.  The effects of the escape sequences
used include:

Move, resize, open, close, raise, and lower a window.  (we tended to lose
  windows reduced to null sizes, and running toolplaces on windows moved to
  screen locations like 10000x10000 generally produced humorous results)
Change the icon's bitmap to that contained with a fully-named file.
Change the icon label.
Change the title bar.
  (an entire set of shell startups was created take advantage of this)

The same sequences, either as stdout or redirected to the controlling
/dev/* file, should achieve similar effects.  They have not all been
tested, nor are they as elegant as toolkit calls, but they may prove
useful.  One of the C-shell startup scripts using such sequences is also
included.

variables:
	esc   = ASCII 27
	bel   = ASCII  7
        spa   = ASCII 32

	setenv esc "^[" ; setenv bel "^G" ; setenv spa " "

#----------------------------------------------------------------------#
#   File:  ~/.elven/sunview
#  [Date:  early 1989, expanded from sequences in the elfshell scripts]
#   Auth:  Christopher Hudnall
#----------------------------------------------------------------------#
alias open		'echo -n "${esc}[1t"'		#open
alias close		'echo -n "${esc}[2t"'		#close
alias mmove		'echo -n "${esc}[3t"'		#move interactively
alias move		'echo -n "${esc}[3;\!:1;\!:2t"'	#top, left coordinate
alias mstretch	'echo -n "${esc}[4t"'			#stretch interactively
alias stretch	'echo -n "${esc}[4;\!:1;\!:2t"'		#width, height
alias expose	'echo -n "${esc}[5t"'			#expose
alias hide		'echo -n "${esc}[6t"'		#Hide
alias refresh	'echo -n "${esc}[7t"'			#Redisplay
alias cstretch	'echo -n "${esc}[8;\!:1;\!:2t"'	#stretch to rows, cols in chars
alias ioreport	'echo -n "${esc}[11t"'		#rpt open / iconic with 1t / 2t
alias preport	'echo -n "${esc}[13t"'		#rpt position with "move" chars
alias spreport	'echo -n "${esc}[14t"'		#size in pixels as above
alias screport	'echo -n "${esc}[18t"'		#size in chars
alias Lreport	'echo -n "${esc}[20t"'		#icon label
alias lreport	'echo -n "${esc}[21t"'		#tool header
alias header	'echo -n "${esc}]l\!*${esc}\"'	#set header
alias iheader	'echo -n "${esc}]L\!*${esc}\"'	#set icon header
alias icon		'echo -n "${esc}]I\!*${esc}\"'	#set icon to file
alias opt_on	'echo -n "${esc}[>\!*;h"'	#turn opt on (opt 1 =pagemode)
alias opt_rpt	'echo -n "${esc}[>\!*;k"'	#report opt  
alias opt_off	'echo -n "${esc}[>\!*;l"'	#turn opt off

----------------------------------------------------------------------

The following script contains a method of setting the header, iheader,
and icon escape sequences for SunView, X10, and X11.  These are being used
to display a line such as:

	[-hostname- /path/name ]

along title bars.  TWM in X11 displays the same data in the Icon Manager
as is displayed in the title, providing a way to tag unmapped windows.
The hook "." gets re-aliased depending on the windows in use.

additional environment variables set at login and associated aliases:
	setenv HOSTNAME `hostname`
	setenv HOSTNICK `expr $HOSTNAME : '\([A-Za-z0-9-]*\)\..*' \| $HOSTNAME`
	setenv HOMETOKEN    '~'
	setenv PROMPT_NORM  '}-$HOSTNICK-${depth}.\!\-\> '
	setenv PROMPT_WIND  '}-${depth}.\!\-\> '
	setenv PROMPT_ROOT  '\[$HOSTNICK\]-${depth}.\!\-\# '
(depth starts at zero at login in the env, and is incremented by subshells.)
	alias cwd   'echo $cwd | sed s+\^${HOME}+${HOMETOKEN}+g'
	alias .     'cwd'           # a default alias for non-window environs.
	alias c     'cd \!* ; .'

INTERFACE must be set to one of the possible input types.

#----------------------------------------------------------------------#
#   File:     ~/.elven/setheaders
#   Author:   Christoph. A. North-Keys (erlkonig at walt.cc.utexas.edu)
#   Notes:    direct descendant of the original elfshell core script
#   Rev:      20,0 Donnerstag.d.1.Juni.1989 (begun 1987)
#   Types:    [ SunView | X10, X11 | off ]
#----------------------------------------------------------------------#
if (("`whoami`" == "root")&&($?PROMPT_ROOT)) then
	set prompt="`echo $PROMPT_ROOT` " 
	alias say echo
else
	switch ("$INTERFACE")
		case "SunView":
			set prompt="`echo $PROMPT_WIND` "
			alias . 'header [-${HOSTNICK}- `cwd` ]'
			alias header	'echo -n "$esc]l\!*$esc\"'
			alias iheader	'echo -n "$esc]L\!*$esc\"'
			alias icon		'echo -n "$esc]I\!*$esc\"'
			alias say 'header \!*'
			breaksw
		case "X10":
			set prompt="`echo $PROMPT_WIND` "
			alias . 'header [-${HOSTNICK}- `cwd` ]'
			alias header	'echo -n "$esc]l\!*$esc"'
			alias iheader	'echo -n "$esc]L\!*$esc"'
			alias icon		'echo -n "$esc]I\!*$esc"'
			alias say 'header \!*'
			breaksw
		case "X":
		case "X11":
			set prompt="`echo $PROMPT_WIND` "
			alias . 'header [-${HOSTNICK}- `cwd` ]'
			alias header	'echo -n "$esc]2 \!*$bel"'
			alias iheader	'echo -n "$esc]1 \!*$bel"'
			alias icon		'echo -n "$esc]I \!*$bel"'
			alias say 'header \!*'
			breaksw
		case "off":
		case "raw":
	    default:
	        set prompt="`echo $PROMPT_NORM` "
	        alias .   'cwd'
	        alias say 'echo "\!*"'
		breaksw
	endsw
endif
#----------------------------------------------------------------------eof

------------------------------------/\----------------------------------------
Seo:  Harp[@Mcc.Com]               /  \/\ ^*^           Christopher North-Keys
Tha mi gu trang a'cluich.         /    \ \         Assoc. Systems Analyst, MCC
--------------------------------(disclaimer)----------------------------------



More information about the Comp.sys.sun mailing list