You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In zsh I am able to set tab and window titles separately in iTerm2, e.g. I have
Tab title: current folder only to easily differentiate tabs by which folder they're open at. In path ~ replaces username (echo -ne "\033]1;{$PWD1/#username/~}\007", where PWD1={$PWD##*/}
Win title: full path with ~ instead of /users/username (echo -ne "\033]2;{$PWD/#"$HOME"/~}\007")
As I understand from #47, fish just sets both windows and tab titles with the same fish_title function.
Is it possible to separate those two, maybe have a separate tab_title function or something so that users who are not using it continue to get both windows and tab title within the old function?
Also, in zsh I am able to add a bell char (\007) to the titles. How do I do that in fish?
Thanks!
P.S.
My system is OS X 10.11.2, iTerm2 2.9.20160113 and fish 2.2.0-542-g4b2495f
I am able to add a bell char (\007) to the titles. How do I do that in fish?
Thanks!
For me in both iTerm2 and Terminal.app with fish, zsh, and bash on 10.11.4 (and I remember earlier) I will often see a bell glyph printed on the correct tab bar if I cause a BEL (\a or \007) while a tab/window is inactive or not getting any input. It goes away when I focus it.
Your report does remind me that I kind of am disappointed that fish itself almost under no circumstances will ring a BEL. Considering the general lack of richness that goes along with a terminal emulator I'm surprised there are zero situations where we'd like to take advantage of a very well supported feature that can convey information without a font: the bell can flash the window visually or ring a quick alert sound (depending on how it's configured. I prefer visual bells.) for free!
It's a very nice way to quickly indicate that an action is having no effect or something is having trouble. Also, the only way for an ignored session in the background that requires some attention to ping me with that bell character and/or dock icon bouncing.
As for titles I actually have found that, as fish does a good job of reporting the accurate CWD, and also most terminals I use are able to figure out the active process on their own... the most preferable thing to do with my title bars is to turn off a custom title in the shell, disabling the function. I simply pick and choose the things I'd like to see in each space directly in my terminal emulator preferences, for the tab and title bar separately: current directory. full path. activity indicators. active program, open document... and it's a more easy, pleasant, and rich experience I'm having than I ever had trying to shove a carefully planned string up there in the past.
Given how basically this is a standard feature with terminals now, though, it does seems to reason that Fish could do a better job of providing relevant information for both the tab titles & (which is space constrained, but visible at the same time as) window titles.
Just sending the same exact thing over two times doesn't make any sense: there is nobody out there who can render tab titles but has a terminal that can't interpret the terminal title OSC.
@faho Yes, the main issue remains — allowing two different settings for window title and tab title
iTerm's integration didn't solve the bell issue, I still get bell->progress circle->pencil in fish (but not in bash) in iTerm.
I'm trying to think of a way to allow users to tailor the behavior without creating new functions, and keeping it such that those who don't care about the distinction don't need to for the current behavior to stay the way it is.
My current idea is a bit of magic, which is fish internally determining if the fish_title function was defined with named arguments, specifically one called type. This will tell fish the title function has opted into getting called twice each time the title is updated instead of just once. It will get called once with a first argument of window, and a second time with a first argument of tab, or whatever the most appropriate cross-terminal way of describing this is. It would be used like this:
function fish_title -atypeswitch$typecase tab
echo stuff for the tab
case window
echo stuff for the window
endend
My current idea is a bit of magic, which is fish internally determining if the fish_title function was defined with named arguments, specifically one called type.
Why the named argument? Just pass it an argument, call it twice, find out who's naughty or nice and use the output? fish_title is usually quite simple and fast, so it shouldn't take too long.
Alternatively:
I'm trying to think of a way to allow users to tailor the behavior without creating new functions
Why not allow specifying fish_tab_title and use that for the tab title if it exists, fish_title otherwise?
Why the named argument? Just pass it an argument, call it twice, find out who's naughty or nice and use the output? fish_title is usually quite simple and fast, so it shouldn't take too long.
Oh, and because we need a way to flag to fish whether this is output to be used for \e]1, \e]2, or \e]0. If we just ran it twice, it looks to us like stuff to be sent \e]1 and then again with \e]2, not \e]0 which is the current behavior.
Activity
floam commentedon Feb 21, 2016
For me in both iTerm2 and Terminal.app with fish, zsh, and bash on 10.11.4 (and I remember earlier) I will often see a bell glyph printed on the correct tab bar if I cause a BEL (
\aor\007) while a tab/window is inactive or not getting any input. It goes away when I focus it.Your report does remind me that I kind of am disappointed that fish itself almost under no circumstances will ring a BEL. Considering the general lack of richness that goes along with a terminal emulator I'm surprised there are zero situations where we'd like to take advantage of a very well supported feature that can convey information without a font: the bell can flash the window visually or ring a quick alert sound (depending on how it's configured. I prefer visual bells.) for free!
It's a very nice way to quickly indicate that an action is having no effect or something is having trouble. Also, the only way for an ignored session in the background that requires some attention to ping me with that bell character and/or dock icon bouncing.
As for titles I actually have found that, as fish does a good job of reporting the accurate CWD, and also most terminals I use are able to figure out the active process on their own... the most preferable thing to do with my title bars is to turn off a custom title in the shell, disabling the function. I simply pick and choose the things I'd like to see in each space directly in my terminal emulator preferences, for the tab and title bar separately: current directory. full path. activity indicators. active program, open document... and it's a more easy, pleasant, and rich experience I'm having than I ever had trying to shove a carefully planned string up there in the past.
Given how basically this is a standard feature with terminals now, though, it does seems to reason that Fish could do a better job of providing relevant information for both the tab titles & (which is space constrained, but visible at the same time as) window titles.
Just sending the same exact thing over two times doesn't make any sense: there is nobody out there who can render tab titles but has a terminal that can't interpret the terminal title OSC.
eugenesvk commentedon Feb 21, 2016
floam commentedon Feb 21, 2016
eugenesvk commentedon Feb 21, 2016
faho commentedon Feb 21, 2016
Is there anything left to do here or does iterm's integration solve the issue?
eugenesvk commentedon Feb 21, 2016
@faho Yes, the main issue remains — allowing two different settings for window title and tab title
iTerm's integration didn't solve the bell issue, I still get bell->progress circle->pencil in fish (but not in bash) in iTerm.
eugenesvk commentedon Feb 21, 2016
floam commentedon Feb 22, 2016
eugenesvk commentedon Feb 22, 2016
floam commentedon Feb 23, 2016
krader1961 commentedon Feb 23, 2016
floam commentedon Feb 23, 2016
eugenesvk commentedon Feb 23, 2016
krader1961 commentedon Feb 24, 2016
eugenesvk commentedon Feb 24, 2016
10 remaining items
floam commentedon Apr 6, 2019
I'm trying to think of a way to allow users to tailor the behavior without creating new functions, and keeping it such that those who don't care about the distinction don't need to for the current behavior to stay the way it is.
My current idea is a bit of magic, which is fish internally determining if the
fish_titlefunction was defined with named arguments, specifically one calledtype. This will tellfishthe title function has opted into getting called twice each time the title is updated instead of just once. It will get called once with a first argument ofwindow, and a second time with a first argument oftab, or whatever the most appropriate cross-terminal way of describing this is. It would be used like this:faho commentedon Apr 6, 2019
Why the named argument? Just pass it an argument, call it twice,
find out who's naughty or niceand use the output?fish_titleis usually quite simple and fast, so it shouldn't take too long.Alternatively:
Why not allow specifying
fish_tab_titleand use that for the tab title if it exists,fish_titleotherwise?floam commentedon Apr 6, 2019
The idea was to avoid executing it twice.
floam commentedon Apr 6, 2019
Oh, and because we need a way to flag to fish whether this is output to be used for
\e]1,\e]2, or\e]0. If we just ran it twice, it looks to us like stuff to be sent\e]1and then again with\e]2, not\e]0which is the current behavior.floam commentedon Apr 6, 2019
Here's what the parameters are, by the way:
2: Set window title
1: Sets tab title
0: Sets both window title and tab title (
fish_titletoday)floam commentedon Apr 7, 2019
Just doing a function may be a better idea, yeah.
floam commentedon Apr 7, 2019
Today I learned:
fish_titlealready gets an argument! Had no idea. edit: and... it does not appear to actually do that in practice.hisnawi commentedon Mar 31, 2020
faho commentedon Mar 31, 2020
hisnawi commentedon Mar 31, 2020
AdamMomen commentedon Nov 24, 2021
fish_tab_title to set terminal tab title independent of window title