Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: the konsole title bar




Andrey Borzenkov wrote:
> On Saturday 28 July 2007, pol wrote:
>> I am using the following command in /etc/zsh/zshrc to change the title
>> bar
>> and tab bar according to the current directory:
>>
>> precmd () {
>>      tab_lable="$PWD:h:t/$PWD:t"
>>      rlength="20"   # number of characters to appear before truncation
>> from
>> the left
>>
>>     dcop "$KONSOLE_DCOP_SESSION" renameSession
>> "$tab_lable[-$rlength,-1]"
>>
>>     }
>>
>> When running vim, the running command is added to  <current dir>, in the
>> title and tab names.
>> However, as vim has been closed, title bar and tab name take the form:
>> <current dir> Konsole <current dir>
>
> may be you mean <current dir> - <current dir> - Konsole
>
> at least that is what I get in such case.
>
>>
>> That is not what expected
>>
>> What is wrong?
>>
>
> There are session name and window title. Some programs do set window
> title;
> this is relatively portable in the sense it works on xterm and derivatives
> as
> well as konsole and even cygwin as far as I remember. Windows title set
> this
> way comes before session name.
>
> what you could do
>
> a) configure all programs you use to no set window title. This may be
> impossible (e.g. sometimes I log in remotely in a system where I simply do
> not have any way to turn this off).
>
> b) set session name to some "innocent" fixed string and use window title
> instead yourself. Setting session name to empty string gives ugly:
>
> <your window title> - - Konsole
>
> may be it is possible to turn session name and Konsole off completely but
> I
> cannot find it.
>
> Oh, and you set window title with
>
>   print -nP -u2 '\033]0;<your title goes here>\a
>


A bit of explanation:  I recognized what he has as something I wrote --
complete with the spelling error I made.

I wrote it for iTerm ons OS X primarily, in which

\e]1  ( or \033]1 )  puts stuff in the tab

and

\e]2  puts stuff in the title bar.

This is specific to iTerm and AFAIK doesn't work with any of the other
tabbed terminal emulators (if it does, it is just by chance).

I like to have the full directory in the title bar and the last and
penultimate directory in the tab.

The problem is with Konsole, \e]1 doesn't put stuff in the tab, but

 dcop "$KONSOLE_DCOP_SESSION" renameSession  foo

does this.  Unfortunately, it also puts the same junk in the title bar,
which I had not even noticed before today, since I hardly ever use konsole
these days (very rarely on OS X and I use xfce4 these days on linux,
including whatever the terminal is that comes with that).

I use the same startup scripts on linux as OS X, and have these available
on a web page in case anyone else wants them, so I am presuming that is
where this originated.





Messages sorted by: Reverse Date, Date, Thread, Author