This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Who controls window title??


Jonathon Merz wrote:
> 
> 
> There is a small GPL'd utility that I think will do what you want.  It's
> called xttitle, you can get it at:
> 
>         http://www.jarvis.com/xttitle/

Why futz with an executable? Put the following in a startup file. If
it's too feature-full for you, cut out all the +|-|= jazz.

I am assuming we are talking about a xterm window. I'd like to know how
to modify a non-xterm title bar. Any ideas?

# add to (+), delete from (-), print (.), or set ([=]) window title
# arguments are eval'd before printing
# title text string exported in TITLE_TEXT

function title # [+ | - | =] title ...
{
        local x t="$TITLE_TEXT"

        case $1 in
        +)      shift
                case $# in
                0)      ;;
                *)      for x
                        do      case " $t " in
                                *" $x "*)       ;;
                                "  ")           t=$x ;;
                                *)              t="$t $x" ;;
                                esac
                        done
                        case $t in
                        $TITLE_TEXT)    return 1 ;;
                        esac
                        ;;
                esac
                ;;

        -)      shift
                case $# in
                0)      ;;
                *)      for x
                        do      case " $t " in
                                *" $x "*)       t="${t%?(
)$x*}${t##*$x?( )}" ;;
                                esac
                        done
                        case $t in
                        $TITLE_TEXT)    return 1 ;;
                        esac
                        ;;
                esac
                ;;
        .)      echo -r -- "$TITLE_TEXT"
                return 0
                ;;
        *)      t="$*"
                ;;
        esac
        export TITLE_TEXT="$t"
        eval x=\"$t\"
        case $TERM in
        630*)   echo -n "^[[?${#x};0v$x" ;;
        vt100|xterm*)   echo -n "^[]0;$x^G" ;;
        *)      return 1 ;;
        esac
        return 0
}


>   The "official" build (ie Makefile) didn't run properly on Cygwin when I
> tried it last, but there is only one source file, and it compiled fine with
> gcc not using make, so you shouldn't have any trouble.
> 
> I have the following function in my .bashrc:
> 
> function cd_xttitle {
>     \cd $1
>     xttitle.exe $(echo $HOSTNAME:$PWD)
> }
> 
> and I have my cd aliased as:
> 
> alias cd='cd_xttitle'
> 
> This will keep the window title to what you are asking for I believe.
> 
> Hope that helps,
> 
> Jon
> 
> --
> 
> -------------------------------------
>   If you had a million Shakespeares,
>   could they write like a monkey?
> 
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple


-- 
Matthew O. Persico
    
http://www.acecape.com/dsl
AceDSL:The best ADSL in Verizon area

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]