Bug 306567 - Tab title set manually is lost when connecting to remote
Summary: Tab title set manually is lost when connecting to remote
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: tabbar (show other bugs)
Version: 2.9.999
Platform: Compiled Sources Linux
: NOR minor
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-10 19:43 UTC by Michel Palleau
Modified: 2015-09-01 19:29 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Proposal to set both titles on manual setting (515 bytes, patch)
2012-09-10 19:43 UTC, Michel Palleau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michel Palleau 2012-09-10 19:43:52 UTC
Created attachment 73798 [details]
Proposal to set both titles on manual setting

When setting manually the tab title with "\e]30;TITLE\a", it only updates the local tab name, not the remote tab name.
So, if connecting to a remote server, "\e]30;TITLE\a" shows the title during half a second before konsole restores the remote tab name.
I have checked the code, and behavior via the dbus setTitle command and via \e]30; command is not consistent.
I propose to make the following change to have the same behavior, id est update both local and remote tab name on any manual setting (be it dbus or character control).

diff --git a/src/Session.cpp b/src/Session.cpp
index dfb0ab7..11c3f4f 100644
--- a/src/Session.cpp
+++ b/src/Session.cpp
@@ -534,7 +534,7 @@ void Session::setUserTitle(int what, const QString& caption)
     if (what == SessionName) {
         if (_localTabTitleFormat != caption) {
             _localTabTitleFormat = caption;
-            setTitle(Session::DisplayedTitleRole, caption);
+            setTitle(static_cast<int>(Session::DisplayedTitleRole), caption);
             modified = true;
         }
     }
Comment 1 Michel Palleau 2012-09-15 14:13:47 UTC
Jekyll Wu fixed the same kind of issue for dbus method "setTitle" in Bug 262089.
Comment 2 Jekyll Wu 2012-09-16 08:34:44 UTC
Actually, bug 262089 is a little different from this issue. That problem in that report was that dbus method only changed the (one-shot) value without updating the two title formats,  while the problem in this report is that escape sequence only changes one title format without changing the other.  

Whatever, there is inconsistency between the dbus method and escape sequence.  However, now I'm not sure which behavior is better.

Code wise, this one line patch makes the code even messier than it already is.  I really need to re-read related code and try to find a better fix.
Comment 3 Richard Hansen 2012-10-12 19:53:27 UTC
What about adding another format specifier?

    Tab Title Set by Shell: %t

The idea would be that users would put %t in the "tab title format" field and/or the "remote tab title format" field.  The %t would be substituted with the most recent string emitted after "\e]30;" and before "\a".
Comment 4 Michel Palleau 2015-08-30 10:20:30 UTC
It seems that Richard's proposal has been implemented: there is now "%w : window title set by shell".

But still, with Konsole Version 15.08.0, it is not working for a remote tab.
I am observing this behavior:
- display of title set by remote with "\e]30;TITLE\a" during half a second
- then display of string "Terminal" (I am using french locale)

Can you implement the usage of %w in remote tab title ?
Comment 5 Michel Palleau 2015-09-01 19:29:06 UTC
IT WORKS.

By setting both local and distant titles to "%w", and using "\e]0;" instead of "\e]30;", the tab title is properly displayed both for local and remote sessions. I have what I wanted :-)

Thank you and keep the good work.