Bug 183963 - renamed tab is being reset
Summary: renamed tab is being reset
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 2.1
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-10 23:36 UTC by Michael Eager
Modified: 2010-06-10 17:02 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.5


Attachments
Proposed patch for "qdbus ...setTitle" method of changing tab title (3.06 KB, patch)
2010-06-08 23:38 UTC, Andrea Solis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Eager 2009-02-10 23:36:11 UTC
Version:           2.1 (using KDE 4.1.4)
Compiler:          gcc-4.3.2 
OS:                Linux
Installed from:    Fedora RPMs

This is a regression from KDE 3.5.

Double-clicking on a tab will bring up a "Rename Tab" box.  Entering a name in the box sets the name for the tab.

This name is replaced with the default after a short time.  It doesn't seem to depend on the settings in the profile.  If the "Tab Title Format" is blank, then the tab name is reset to "Shell".  If it is one of the other possible values, then it looks like that default is used.

This only happens to the tab with active focus, not the other tabs.  The name being reset doesn't appear to be related to the command issued in the window, switching between tabs, or switching instances of konsole.  

This bug makes setting the tab name unusable.
Comment 1 Robert Knight 2009-02-11 13:42:41 UTC
Is an SSH session running in the shell?
Comment 2 Michael Eager 2009-02-11 17:21:42 UTC
No ssh session running in tabs.  Only bash.  

The name being reset seems to be more variable and random than I previously thought.  I've had the name change for tabs which did not have active focus, or not be reset, even when the tab was active.  

Comment 3 Robert Knight 2009-02-11 19:46:56 UTC
> The name being reset seems to be more variable
> and random than I previously thought

It may help if I were to explain that title updates are done two seconds after the last keyboard input to the session.
Comment 4 Michael Eager 2009-02-11 20:00:55 UTC
The delay was a bit confusing.  But the tag names are changing much later than two seconds after the last input.  

I have an instance of konsole running with six tabs.  The "Tab Title Format" in the profile is blank and each tab has been manually given a different name.  Only bash running in each tab.  Sometimes when I return to the window, the tab names are as previously set.  Sometimes one or more of the tab names has changed to 'Shell', without there being any activity (either input or output) in the tab.  
Comment 5 Michael Eager 2009-04-21 19:10:07 UTC
This appears to only happen when running under Gnome.
Comment 6 joachim fehn 2009-12-15 12:56:32 UTC
KDE 4.3.3 (upgraded from openSuSE 11.1)
Konsole 2.3.3

Any modified tab names are reset to the previous values after a few seconds, independent of focus, independent of "Tab Title Format", also when running under KDE.

It behaves the same way, when the tab is renamed by means of dbus.
Comment 7 Geoff Kassel 2009-12-30 08:56:02 UTC
KDE 4.3.3 (just upgraded from KDE 3.5.9)
Konsole 2.3.3
GCC 4.3.4 (just upgraded from 3.4.6)

Titles are resetting on tabs a short while after switching between tabs on my setup as well. Running under KDE also.
Comment 8 Amand Tihon 2010-02-13 12:44:51 UTC
The tabs being automatically renamed is pretty annoying. 

I'd like to be able to automatically set tab titles with my zsh precmd and preexec functions, as it was possible under KDE 3. The limited behaviour available in the profile configuration doesn't fit my needs, unfortunately.
Comment 9 JohnWelborn 2010-02-26 21:01:55 UTC
*** This bug has been confirmed by popular vote. ***
Comment 10 Brandon Boles 2010-05-19 17:43:20 UTC
For me, tabs only get renamed when I set them via dbus with this command:

qdbus org.kde.konsole $(echo $KONSOLE_DBUS_SESSION) setTitle 1 "New Title"

If I set the tab name manually by double-clicking on the tab, it will stick.

Fedora 11
KDE 4.4.3
Konsole 2.4.3
Qt 4.6.2

Similar to bug 189828 but I'm not sure if this is the same issue.  With the current code the issue only seems to be with setting the title via dbus.
Comment 11 Andrea Solis 2010-06-01 20:31:58 UTC
If the tab name is changed by qdbus, this is why it almost immediately reverts back to it's previous value:

> qdbus org.kde.konsole $KONSOLE_DBUS_SESSION org.kde.konsole.Session.setTitle 1 "foo" 

1.  The qdbus command is processed by Session::setTitle which sets the new value in Session::_displayTitle:

        Session::_displayTitle = "foo"

2.  SessionController::snapshot is called, it obtains the current title by calling Session::getDynamicTitle

3.  Session::getDynamicTitle formats the title by calling ProcessInfo::format and passing either _localTabTitleFormat or _remoteTabTitleFormat.  It does *not* use _displayTitle!

4.  ProcessInfo::format replaces the formatting characters in _localTabTitleFormat (or _remoteTabTitleFormat).  Since _displayTitle is not used, and _localTabTitleFormat is not changed by Session::setTitle, the previous title is returned.

Therefore, the previous title is displayed in the tab by SessionController::snapshot

Proposed fix:

Add a new binding to the Session class so the tab title format can be controlled via qdbus:

Q_SCRIPTABLE void Session::setTabTitleFormat(int context, const QString& format)

To provide optimal control, it would be nice to add a "pre-formatting" method to the Session class, Session::formatDynamicTitle.  Introduce two new formatting characters, one would be replaced by _nameTitle and another by _displayTitle.    

If this is implemented, then Session::getDynamicTitle would first call Session:formatDynamicTitle, then pass the resulting string onto the ProcessInfo::format method.
Comment 12 Andrea Solis 2010-06-08 23:38:57 UTC
Created attachment 47821 [details]
Proposed patch for "qdbus ...setTitle" method of changing tab title

This patch was developed and tested using KDE version 4.3.1.  If accepted, the patch would add two new object methods for qdbus:
    setTabTitleFormat
    tabTitleFormat

These would be used instead of setTitle to change the tab title via qdbus:
qdbus org.kde.konsole $KONSOLE_DBUS_SESSION org.kde.konsole.Session.setTabTitleFormat 0 "foo"
Comment 13 Kurt Hindenburg 2010-06-10 17:02:58 UTC
SVN commit 1136726 by hindenburg:

Add 2 new dbus methods for setting tab title formats so that they are persistent.
Thanks to Andrea Solis for original patch.

FIXED_IN: 4.5
BUG: 183963


 M  +24 -0     Session.cpp  
 M  +14 -0     Session.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1136726