Bug 125796 - Konsole tab titles don't refresh themselves automatically (without a user action)
Summary: Konsole tab titles don't refresh themselves automatically (without a user act...
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 1.6.2
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-18 11:45 UTC by Philippe Gassmann
Modified: 2006-12-06 17:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Gassmann 2006-04-18 11:45:27 UTC
Version:           1.6.2 (using KDE KDE 3.5.2)
Installed from:    Gentoo Packages
OS:                Linux

I'm using some scripts (written in sh, zsh and python) that set the title of the terminal window automatically, during very long operations... 
Konsole refresh the title of its tabs only if they are active (after the user clicked on it). It should always refresh these titles as if these tabs would be active.
Comment 1 Kurt Hindenburg 2006-05-15 19:08:21 UTC
Hmm, it works here... I just wrote a stupid script to change the tab title after 2 seconds...
you can also change the title via DCOP.

Post your script or portion of it.
Comment 2 Philippe Gassmann 2006-05-16 09:33:05 UTC
Here is my script used to automatically set the title of Konsole (I used zsh as shell) : 
if [ $TERM = 'xterm' ]; then
                precmd () { print -Pn "\e]0;%~\a" }
                preexec () { print -Pn "\e]0;[$1]%~\a" }
fi
When I start a command, it wrote the name of the command in the window title, at the end of the command, just the current directory is displayed.

In Konsole, I activated the option : "Set tab title to match window title"

I open two tabs in Konsole, in the first one, I execute "sleep 10" ( the tab title is set to "[sleep 10]~ - Shell No. 1") then, I activate the second tab and wait for 10 seconds. After that the sleep command ended, the tab title should return to "~ - Shell No.2". It does not happen like that : it is returning to the right title only when I activate the tab.
Comment 3 Kurt Hindenburg 2006-05-16 17:22:44 UTC
Changing the \e]0 to \e]30  appears to work.

30 = session tab title
0 = window title

Comment 4 Philippe Gassmann 2006-05-17 11:56:57 UTC
It's working when setting the tab title ; but the bug on the window title is still present...
Comment 5 Kurt Hindenburg 2006-05-17 18:03:22 UTC
SVN commit 541914 by hindenburg:

Fix issue with tab/window titles not refreshing for the non-active session.

BUG: 125796


 M  +19 -12    konsole.cpp  
 M  +1 -1      konsole.h  
 M  +2 -2      session.cpp  
 M  +1 -1      session.h  


--- branches/KDE/3.5/kdebase/konsole/konsole/konsole.cpp #541913:541914
@@ -2189,18 +2189,25 @@
   if (n_render >= 3) pixmap_menu_activated(n_render);
 }
 
-void Konsole::updateTitle()
+void Konsole::updateTitle(TESession* _se)
 {
-  setCaption( se->fullTitle() );
-  setIconText( se->IconText() );
-  tabwidget->setTabIconSet(se->widget(), iconSetForSession(se));
-  QString icon = se->IconName();
-  KRadioAction *ra = session2action.find(se);
+  if ( !_se )
+    _se = se;
+
+  if (_se == se)
+  {
+    setCaption( _se->fullTitle() );
+    setIconText( _se->IconText() );
+  }
+  tabwidget->setTabIconSet(_se->widget(), iconSetForSession(_se));
+  QString icon = _se->IconName();
+  KRadioAction *ra = session2action.find(_se);
   if (ra && (ra->icon() != icon))
     ra->setIcon(icon);
-  if (m_tabViewMode == ShowIconOnly) tabwidget->changeTab( se->widget(), QString::null );
+  if (m_tabViewMode == ShowIconOnly) 
+    tabwidget->changeTab( _se->widget(), QString::null );
   else if (b_matchTabWinTitle)
-    tabwidget->changeTab( se->widget(), se->fullTitle().replace('&',"&&"));
+    tabwidget->changeTab( _se->widget(), _se->fullTitle().replace('&',"&&"));
 }
 
 void Konsole::initSessionFont(QFont font) {
@@ -2863,8 +2870,8 @@
   // If you add any new signal-slot connection below, think about doing it in konsolePart too
   connect( s,SIGNAL(done(TESession*)),
            this,SLOT(doneSession(TESession*)) );
-  connect( s, SIGNAL( updateTitle() ),
-           this, SLOT( updateTitle() ) );
+  connect( s, SIGNAL( updateTitle(TESession*) ),
+           this, SLOT( updateTitle(TESession*) ) );
   connect( s, SIGNAL( notifySessionState(TESession*, int) ),
            this, SLOT( notifySessionState(TESession*, int)) );
   connect( s, SIGNAL(disableMasterModeConnections()),
@@ -3649,7 +3656,7 @@
   disconnect( _se->getEmulation(),SIGNAL(changeColumns(int)), this,SLOT(changeColumns(int)) );
   disconnect( _se, SIGNAL(changeTabTextColor(TESession*, int)), this, SLOT(changeTabTextColor(TESession*, int)) );
 
-  disconnect( _se,SIGNAL(updateTitle()), this,SLOT(updateTitle()) );
+  disconnect( _se,SIGNAL(updateTitle(TESession*)), this,SLOT(updateTitle(TESession*)) );
   disconnect( _se,SIGNAL(notifySessionState(TESession*,int)), this,SLOT(notifySessionState(TESession*,int)) );
   disconnect( _se,SIGNAL(disableMasterModeConnections()), this,SLOT(disableMasterModeConnections()) );
   disconnect( _se,SIGNAL(enableMasterModeConnections()), this,SLOT(enableMasterModeConnections()) );
@@ -3739,7 +3746,7 @@
   connect( session,SIGNAL(done(TESession*)),
            this,SLOT(doneSession(TESession*)) );
 
-  connect( session,SIGNAL(updateTitle()), this,SLOT(updateTitle()) );
+  connect( session,SIGNAL(updateTitle(TESession*)), this,SLOT(updateTitle(TESession*)) );
   connect( session,SIGNAL(notifySessionState(TESession*,int)), this,SLOT(notifySessionState(TESession*,int)) );
 
   connect( session,SIGNAL(disableMasterModeConnections()), this,SLOT(disableMasterModeConnections()) );
--- branches/KDE/3.5/kdebase/konsole/konsole/konsole.h #541913:541914
@@ -163,7 +163,7 @@
   void changeColLin(int columns, int lines);
   void notifySessionState(TESession* session,int state);
   void notifySize(int columns, int lines);
-  void updateTitle();
+  void updateTitle(TESession* _se=0);
   void prevSession();
   void nextSession();
   void activateMenu();
--- branches/KDE/3.5/kdebase/konsole/konsole/session.cpp #541913:541914
@@ -220,7 +220,7 @@
        te->update();
     }
 
-    emit updateTitle();
+    emit updateTitle(this);
 }
 
 QString TESession::fullTitle() const
@@ -348,7 +348,7 @@
   if (!autoClose)
   {
     userTitle = i18n("<Finished>");
-    emit updateTitle();
+    emit updateTitle(this);
     return;
   }
   if (!wantedClose && (exitStatus || sh->signalled()))
--- branches/KDE/3.5/kdebase/konsole/konsole/session.h #541913:541914
@@ -139,7 +139,7 @@
   void forkedChild();
   void receivedData( const QString& text );
   void done(TESession*);
-  void updateTitle();
+  void updateTitle(TESession*);
   void notifySessionState(TESession* session, int state);
   void changeTabTextColor( TESession*, int );
 
Comment 6 John Stamp 2006-05-30 21:49:17 UTC
It looks like the patch wasn't complete.  It breaks updateTitle connections in konsole_part with the following error:
    QObject::connect: No such signal TESession::updateTitle()
    QObject::connect:  (sender name:   'unnamed')
    QObject::connect:  (receiver name: 'unnamed')
The patch below fixes it so yakuake can again automatically rename sessions.

konsole.cpp may contain more calls to updateTitle that need fixing too.

--- kdebase-3.5.3.orig/konsole/konsole/konsole_part.cpp
+++ kdebase-3.5.3/konsole/konsole/konsole_part.cpp
@@ -922,7 +922,7 @@
   if ( se ) se->setListenToKeyPress(true);
 }
 
-void konsolePart::updateTitle()
+void konsolePart::updateTitle(TESession*)
 {
   if ( se ) emit setWindowCaption( se->fullTitle() );
 }
@@ -1064,8 +1064,8 @@
            this,SLOT(doneSession(TESession*)) );
   connect( se,SIGNAL(openURLRequest(const QString &)),
            this,SLOT(emitOpenURLRequest(const QString &)) );
-  connect( se, SIGNAL( updateTitle() ),
-           this, SLOT( updateTitle() ) );
+  connect( se, SIGNAL( updateTitle(TESession*) ),
+           this, SLOT( updateTitle(TESession*) ) );
   connect( se, SIGNAL(enableMasterModeConnections()),
            this, SLOT(enableMasterModeConnections()) );
   connect( se, SIGNAL( processExited(KProcess *) ),
--- kdebase-3.5.3.orig/konsole/konsole/konsole_part.h
+++ kdebase-3.5.3/konsole/konsole/konsole_part.h
@@ -89,7 +89,7 @@
     void doneSession(TESession*);
     void sessionDestroyed();
     void configureRequest(TEWidget*,int,int x,int y);
-    void updateTitle();
+    void updateTitle(TESession*);
     void enableMasterModeConnections();
 
  private slots:
Comment 7 Kurt Hindenburg 2006-05-31 18:00:28 UTC
SVN commit 546980 by hindenburg:

Fix warnings dealing with updateTitle(TESession*).  As far as I can
tell, updateTitle in konsole_part has no effect.

CCBUG: 125796 


 M  +3 -3      konsole_part.cpp  
 M  +1 -1      konsole_part.h  


--- branches/KDE/3.5/kdebase/konsole/konsole/konsole_part.cpp #546979:546980
@@ -922,7 +922,7 @@
   if ( se ) se->setListenToKeyPress(true);
 }
 
-void konsolePart::updateTitle()
+void konsolePart::updateTitle(TESession *)
 {
   if ( se ) emit setWindowCaption( se->fullTitle() );
 }
@@ -1064,8 +1064,8 @@
            this,SLOT(doneSession(TESession*)) );
   connect( se,SIGNAL(openURLRequest(const QString &)),
            this,SLOT(emitOpenURLRequest(const QString &)) );
-  connect( se, SIGNAL( updateTitle() ),
-           this, SLOT( updateTitle() ) );
+  connect( se, SIGNAL( updateTitle(TESession*) ),
+           this, SLOT( updateTitle(TESession*) ) );
   connect( se, SIGNAL(enableMasterModeConnections()),
            this, SLOT(enableMasterModeConnections()) );
   connect( se, SIGNAL( processExited(KProcess *) ),
--- branches/KDE/3.5/kdebase/konsole/konsole/konsole_part.h #546979:546980
@@ -89,7 +89,7 @@
     void doneSession(TESession*);
     void sessionDestroyed();
     void configureRequest(TEWidget*,int,int x,int y);
-    void updateTitle();
+    void updateTitle(TESession*);
     void enableMasterModeConnections();
 
  private slots:
Comment 8 John B 2006-12-06 17:32:58 UTC
Thanks for fixing this; I was about to report this one, but I guess the fix just hasn't propagated down into the version of Konsole I have.  :)