Window title to reflect the current program #242

Closed
opened 10 months ago by AdrienLeGuillou · 6 comments

Hi,

is there a way to have the window title change depending on whats going on inside foot?

On alacritty that I used previously, running htop would change the window title to "htop", which is really usefull for using window switchers on sway. Similarly, the set title option of vim would reflect the path of the currently edited file in the title.

Thanks for this great software!

Hi, is there a way to have the window title change depending on whats going on inside foot? On alacritty that I used previously, running `htop` would change the window title to "htop", which is really usefull for using window switchers on sway. Similarly, the `set title` option of vim would reflect the path of the currently edited file in the title. Thanks for this great software!
Owner

That should already be working. You can test it with echo -e '\e];hello world\e\\' && sleep 5.

I'm not sure about vim, but I don't think htop can set the window title itself. Instead, you typically configure your shell to emit the escape when executing a command.

Not sure which shell you're using, but here's what I have in zsh:

# Called when executing a command
function preexec {
    print -Pn "\e]0;${(q)1}\e\\"
}

Make sure your shell is configured to do this, and maybe check it isn't doing this for a specific set of terminfo names only?

That should already be working. You can test it with `echo -e '\e];hello world\e\\' && sleep 5`. I'm not sure about `vim`, but I don't think `htop` can set the window title itself. Instead, you typically configure your shell to emit the escape when executing a command. Not sure which shell you're using, but here's what I have in `zsh`: ```sh # Called when executing a command function preexec { print -Pn "\e]0;${(q)1}\e\\" } ``` Make sure your shell is configured to do this, and maybe check it isn't doing this for a specific set of terminfo names only?
Owner

But you're right, vim doesn't seem to work. I'll try to take a look at this later. Chances are it's using a whitelist to filter out terminfos it doesn't recognize.

But you're right, `vim` doesn't seem to work. I'll try to take a look at this later. Chances are it's using a whitelist to filter out terminfos it doesn't recognize.

Thanks, your snippet indeed allow the title to be set as the last command typed.

I am on archlinux using zsh (oh-my-zsh) with DISABLE_AUTO_TITLE="false"

On my other terms (termite and alacritty), if I run:

  • htop: the title is "htop"
  • nvim test: the title is "test (~) NVIM"
  • after startup on home, the title is: "~" on alacritty and "name@host: ~" with termite

this last one is explained here: https://wiki.archlinux.org/index.php/Alacritty#%22user@host:cwd%22_in_Window_Title_Bar

I will look more into how oh-my-zsh works this out for the other terms

Thanks, your snippet indeed allow the title to be set as the last command typed. I am on archlinux using zsh (oh-my-zsh) with DISABLE_AUTO_TITLE="false" On my other terms (termite and alacritty), if I run: - `htop`: the title is "htop" - nvim test: the title is "test (~) NVIM" - after startup on home, the title is: "~" on alacritty and "name@host: ~" with termite this last one is explained here: https://wiki.archlinux.org/index.php/Alacritty#%22user@host:cwd%22_in_Window_Title_Bar I will look more into how oh-my-zsh works this out for the other terms
Owner

Hmm, looks like vim is using the terminal's status line capabilities to set the window title.

Interrestingly enough, I was sort of involved in getting this support into Alacritty: https://github.com/alacritty/alacritty/issues/1636#issuecomment-428214795. I had completely forgotten about that :)

Hmm, looks like vim is using the terminal's **status line** capabilities to set the window title. Interrestingly enough, I was sort of involved in getting this support into Alacritty: https://github.com/alacritty/alacritty/issues/1636#issuecomment-428214795. I had completely forgotten about that :)
dnkl added the
bug
label 10 months ago
Owner

@AdrienLeGuillou #243 should solve the vim issue. It's a terminfo update only, so make sure you re-build and re-install the terminfo files.

@AdrienLeGuillou https://codeberg.org/dnkl/foot/pulls/243 should solve the vim issue. It's a terminfo update only, so make sure you re-build and re-install the terminfo files.
dnkl closed this issue 10 months ago
dnkl referenced this issue from a commit 10 months ago

It behaves exactly as alacritty now.

Thanks!!

It behaves exactly as alacritty now. Thanks!!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.