-
There are some predefined fields for the "tab_title_template" option, like "index", "title" (= user name), asf. I was trying to get the hostname somehow entered, but failed. As I can write When I try that in Python with an f-string, it works, if I make the appropriate import beforehand:
So, it would probably work in kitty.conf as well, if I could somehow use an import instruction. Or can I specify a kitten in the title? I have also tried |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 3 replies
-
Whats the use ase? If you use os.usname() in a template all tabs will get the same hostname so what's the point? I am guessing you want the tab title to show the hostname when you ssh into some host in the active window in that tab. The way to do that is to set the window title or tab title using either escape codes or kitty remote control before sshing in. So write a wrapper script for ssh to do that, and use it to ssh. |
Beta Was this translation helpful? Give feedback.
-
On Tue, Dec 29, 2020 at 06:31:45AM -0800, nst0022 wrote:
OK, I understand the wrapper script for ssh would set the tab title, but when I come back, I can probably not trigger a second script that restores it to its previous state.
Sure you can:
#!/bin/sh
kitty @ set-tab-title whatever
ssh whatever
kitty @ set-tab-title
|
Beta Was this translation helpful? Give feedback.
-
I had to go a step back and figure out, how tab titles and window titles generally work, and noticed two peculiarities: (1) Tab titles (2) OS window titles |
Beta Was this translation helpful? Give feedback.
-
On Tue, Dec 29, 2020 at 10:45:16PM -0800, nst0022 wrote:
I had to go a step back and figure out, how tab titles and window titles generally work, and noticed two peculiarities:
(1) Tab titles
Say the tab title contains {title}, then the userid is displayed.
If I switch the user with "su", the new userid is displayed, as expected.
If I return from "su", the original userid is restored, again as expected.
However, if I ssh to another host and switch to another user there, the original userid remains untouched.
Bug or feature?
What title is displayed depends on what the program running in the
window sets the title to. Presumably, the computer you are sshing into
does not set window titles.
…
(2) OS window titles
If I open kitty with the --title command line option, the title is displayed in the window's title bar.
If I open any new tab, the title in the window's title bar is overwritten with the userid.
Only the very first tab shows the window's title specified in the command line parameter.
Bug or feature?
--title sets window title, not OS window title. The OS window title
simply inherits from the current active window title. Similarly tab
titles inherit from active window title, unless overriden.
|
Beta Was this translation helpful? Give feedback.
-
Sorry, the discussion gets too complicated, I have to quit it. I have already an alternative solution to my initial intention. No hard feelings :-). |
Beta Was this translation helpful? Give feedback.
-
Your ssh wrapper does not work here, because the output of Besides that, another problem would be, if I wanted to set a tab title while on the remote host, I needed to install kitty there, which would either be an additional hassle, or a show stopper. Anyway, thanks for your reply. And, of course, I would never override TERM :-). |
Beta Was this translation helpful? Give feedback.
-
I was more interested in setting the tab titles, rather than the window title :-)
I will do that :-) |
Beta Was this translation helpful? Give feedback.
-
Problem solved :-). First, thanks to @aorith for pointing me to your escape sequences. This was the key to the solution. Second, my apologies to Kovid that I had not understood you from the beginning. I am just a few days with kitty and there is definitely some learning to do :-). Initially a disambiguation: I call the outermost window kitty runs in 'window' and its title the 'window title', a new tab is a 'tab' and its title the 'tab title', and any new window produced with ctrl-shift-enter a 'split window' (which has no visible title). Third, the problem I had with overwriting the 'window title' laid in each and every So, I replaced that part of the prompt with hostname and userid and synchronized all Fourth, I learned, that each 'split window' has its own hidden 'window title', so there is no need to place the hostname or the user on a tab explicitly (I just show the index now, to make the tab narrow, but I could also add the title). Upon selection of any 'split window', the visible 'window title' (and the respective 'tab title' if specified) is updated by kitty automatically. So, just a clean This is the part, where the window title is prepended:
Making this a part of the prompt ensures that each |
Beta Was this translation helpful? Give feedback.
Problem solved :-).
First, thanks to @aorith for pointing me to your escape sequences. This was the key to the solution.
Second, my apologies to Kovid that I had not understood you from the beginning. I am just a few days with kitty and there is definitely some learning to do :-).
Initially a disambiguation:
I call the outermost window kitty runs in 'window' and its title the 'window title', a new tab is a 'tab' and its title the 'tab title', and any new window produced with ctrl-shift-enter a 'split window' (which has no visible title).
Third, the problem I had with overwriting the 'window title' laid in each and every
.bashrc
file I have on all my machines. After setting the PS1 prompt,…