This is the mail archive of the cygwin 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]
Other format: [Raw text]

Re: mintty suggestion


I don't know if this will resolve your problem, but I deal with long
pathnames (as a prompt) by using the following function (I set it up
as a function so that I can keep changing the prompt as I move
around):

function set_prompt
{
    if [ `pwd | sed "s|${HOME}|~|" | wc -c` -gt 15 -a \
         "/`pwd | awk -F/ '{print $(NF-1)\"/\"$NF}'`" != "`pwd` " ]
    then
        PS1=${HOSTNAME}:.../`pwd | awk -F/ '{print $(NF-1)"/"$NF}'`'->'
    else
        PS1=${HOSTNAME}:`pwd | sed "s|${HOME}|~|"`'->'
    fi
}

Pretty much it just looks at the pathname and, if it's longer than 15
characters, shortens it down to "..." and two levels.  if the
directory includes my home directory, then that is shortened to "~".

The syntax is bash.


Later,

Richard.

On Thu, May 10, 2012 at 3:34 PM, Nellis, Kenneth
<Kenneth.Nellis@acs-inc.com> wrote:
>
> With X-Windows, one can independently set the titles of the terminal
> window and the window's icon.
>
> to set window title: ESC ] 2 ; <title> ^G
> to set icon title: ? ESC ] 1 ; <title> ^G
>
> Analogously, it would be nice if Mintty would allow me to independently
> set the titles of the window and the associated taskbar button.
>
> I set my window title to $PWD, but this is typically too long for
> the taskbar button, so I'd like to be able to separately set it
> to ${PWD##*/}.
>
> --Ken Nellis
>
> --
> Problem reports: ? ? ? http://cygwin.com/problems.html
> FAQ: ? ? ? ? ? ? ? ? ? http://cygwin.com/faq/
> Documentation: ? ? ? ? http://cygwin.com/docs.html
> Unsubscribe info: ? ? ?http://cygwin.com/ml/#unsubscribe-simple
>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      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]