Repository navigation
MainWindow: Use the XTerm title if defined - #602
Conversation
jeremypw
left a comment
There was a problem hiding this comment.
This PR causes a regression in showing the path as the window title under normal conditions.
I've added suggestions as to how to fix this. I am not sure whether you need to check whether current_working_directory is something valid but it is probably safer to test this and use TerminalWidget.DEFAULT_LABEL as an ultimate fallback.
| title = current_terminal.window_title != "" ? current_terminal.window_title | ||
| : TerminalWidget.DEFAULT_LABEL; |
There was a problem hiding this comment.
We need to show the path in as the window title, if not overridden.
| title = current_terminal.window_title != "" ? current_terminal.window_title | |
| : TerminalWidget.DEFAULT_LABEL; | |
| title = current_terminal.window_title != "" ? current_terminal.window_title | |
| : current_terminal.current_working_directory; |
| title = current_terminal.window_title != "" ? current_terminal.window_title | ||
| : TerminalWidget.DEFAULT_LABEL; |
There was a problem hiding this comment.
We need to show the path in as the window title, if not overridden.
| title = current_terminal.window_title != "" ? current_terminal.window_title | |
| : TerminalWidget.DEFAULT_LABEL; | |
| title = current_terminal.window_title != "" ? current_terminal.window_title | |
| : current_terminal.current_working_directory; |
| string term_label = terminal.window_title != "" ? terminal.window_title | ||
| : Path.get_basename (term_path); |
There was a problem hiding this comment.
This causes a regression when there isn't a custom prompt set in .bashrc. In that case the terminal label is the same as the terminal prompt (and window title) which is not what is wanted. The label should always show the terminal path (disambiguated).
There was a problem hiding this comment.
that's because .bashrc set a title by default:
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esacelementary use a patch to set the title as dir: last_cmd or actual_cmd, see: https://github.com/elementary/os-patches/blob/712e7a310b32c205fde0c73025c54f1be9181e3e/debian/skel.bashrc#L114-L171
| string term2_name = terminal2.window_title != "" ? terminal2.window_title | ||
| : Path.get_basename (term2_path); |
There was a problem hiding this comment.
See above comment re tab label regression.
|
@Marukesu You do not seem to have fixed the tab label regression when no custom prompt? |
I think i misunderstand you review. as i said before, the |
This PR should only change the appearance of Terminal sufficient only to fix the linked issue - that is the setting a custom window title from the command-line. It should not change the appearance in any other way. If you feel Terminal behaves incorrectly in another way then you should raise another issue about that. You are right that Terminal does not show tab labels the same way as e.g. Mate Terminal but that is, I think, by design. |
i did it this way because was how it worked before #584 when there was a title. |
|
@Marukesu Sorry for the delay in re-reviewing. I think this is now acceptable subject to resolution of the conflicts. |
|
Note: I had to use |
Yeah, I'm using zsh and echo apply the escape characters automatically here, while bash needs the |
jeremypw
left a comment
There was a problem hiding this comment.
Allows setting window title from commandline without affecting tab labelling. Thanks!
re-enable the use of
window_titleif there's a defined title. if the title is empty, we fallback to the current directory for tabs and set the title withTerminalWidget.DEFAULT_LABELcloses #593