Title bar flicker fix for XTerm [setting title only on "cd"]

Christopher North-Keys harp at Pkg.Mcc.COM
Wed Oct 3 14:27:40 AEST 1990


In article <1990Oct3.011511.2263 at mlb.semi.harris.com>,
geg at beep.mlb.semi.harris.com (Greg Garland) writes:
| In article <28434 at pasteur.Berkeley.EDU>, stolcke at ICSI.Berkeley.EDU
(Andreas Stolcke) writes:
| |> In article <6459 at vanuata.cs.glasgow.ac.uk>,
sinclair at cs.glasgow.ac.uk (Duncan Sinclair) writes:
| |> |> Using tcsh, I set re-set the title of xterm before each shell
prompt,
| |> May I suggest a different approach to the same end.  Instead of 
| |> having the tcsh prompt string set the title bar on every command,
| |> alias the `cd ' command so as to set it only when actually changing
the
| |> current directory.  (This should work for any shell with something
equivalent
| |> to an aliasing mechanism).
| |> 
| 
| Better call it something besides 'cd', though, like 'xcd'.  I called
it 'cd'
| originally, but I noticed that when I ran sunview (to use some non-X
stuff) 
| the escape sequences seem to cause the SunView 'shelltool's to hang.
| 
| Greg G.

DISCLAIMER:  If there's an obviously better way in the Csh, just *tell*
me, eh?

Try making the alias "c", and then, in your .cshrc startup scripts, set
the
directory-echo alias (here, ".") appropriately for the window system.

Possible approaches:
X windows:   DISPLAY should exist, and TERM will be "xterm"
Sunview:     WINDOW_PARENT should exist, and TERM will be "sun" or
"sun-cmd"

An example (condensed from the elfshell, version 29) using $term:

               ---------

setenv esc '^['		# an escape char
setenv bel '^G'		# a bell char
setenv HOSTNAME `hostname`
setenv HOSTNICK `expr $HOSTNAME : '\([A-Za-z0-9-]*\)\..*' \| $HOSTNAME`

if ($?tcsh) then
    alias c 'cd \!*'        # Don't alias this to "cd"---bad.
    alias cwdcmd .          # This arranges for "cd" to update the title
as well.
else
    alias c 'cd \!* ; .'    # Don't alias this to "cd"---bad.
endif

if (! $?term) set term = ''	# fall through to default.
switch ("$term")
    case "sun*":
        alias . 'header [-${HOSTNICK}- `dirs` ]'
        alias header    'echo -n "$esc]l\!*$esc\"'
        alias iheader   'echo -n "$esc]L\!*$esc\"'
        alias icon      'echo -n "$esc]I\!*$esc\"'
        breaksw
    case "xterm":
        alias . 'header [-${HOSTNICK}- `dirs` ];iheader ${HOSTNICK}:
$cwd:t'
        alias header    'echo -n "$esc]2;\!*$bel"'
        alias iheader   'echo -n "$esc]1;\!*$bel"'
        alias icon      'echo -n "$esc]I;\!*$bel"'
        breaksw
    default:
        alias . 'dirs'
        set term = `tset - -I -Q -r -m :\?vt100`
    breaksw
endsw

               ---------

Other aliases, some using environment variables.  Note that EDITOR gets
reset by sunview and X startup scripts to be emacsclient instead of vi.

alias ..     'cd ..; .'
alias ...    'cd $cwd:h ; .'   # A neat trick to move to the *logical*
parent.
alias /      'clear ; .'       # Root of screen (?)
alias ~      'cd ~\!* ; .'
alias j      'jobs -l'
alias p      '$PAGER'
alias h      'history -r | p'
alias f      'fg %\!:1'
alias y      '$EDITOR'        # "yank" (was "warp") for emacsclient
program
alias ]d     'pushd \!* ; .'
alias [d     'popd ; .'

#    Be verra careful not t'hide the system rm --- should NOT be a
script.
alias rm     'ls -Fsd \!*; echo -n "remove? "; if ("$<" == "y") /bin/rm
\!*'



--
________________________________________________________________________
_______
Christopher Alex.North-Keys                          Associate Systems
Analyst
Group Talisman                                                 
Harp[@Mcc.Com]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~



More information about the Comp.unix.questions mailing list