Summary: | Konsole is very slow to perform a title bar / tab bar update | ||
---|---|---|---|
Product: | [Applications] konsole | Reporter: | Alain Knaff <kde> |
Component: | general | Assignee: | Konsole Developer <konsole-devel> |
Status: | REPORTED --- | ||
Severity: | normal | CC: | bugs.kde |
Priority: | NOR | ||
Version: | 22.12.3 | ||
Target Milestone: | --- | ||
Platform: | Debian stable | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Alain Knaff
2023-07-23 21:08:43 UTC
I started investigating this in more detail, and here is what I found: 1. Session::setSessionAttribute gets invoked as soon as the ANSI sequence is received. 2. Session::setSessionAttribute copies the "caption" method parameter to the _userTitle object attribute, and sets local variable modified to true (if title did indeed change) 3. Near the end, it emits sessionAttributeChanged() if modified 4. SessionController::sessionAttributeChanged() indeed activates immediately (good), and attempts to set the title using ViewProperties::setTitle 5. However, it gets the "wrong" title to set. In step #2, session._userTitle was set, however, sessionAttributeChanged() gets session._displayName (via session()->title(Session::DisplayedTitleRole);) 6. 2 seconds later, _userTitle gets copied over to _displayTitle by Session::setTitle, and ViewProperties::setTitle gets invoked again, and this time succeeds in setting the correct (i.e. new) title. => The immediate invocation of step #4 shows that there is indeed an intent to perform the title update promptly. However, step #6 (or equivalent) should be invoked before it as well. The following patch is a stop-gap measure which fixes the issue: --- konsole-orig/konsole-22.12.3/src/session/Session.cpp 2023-02-27 05:02:33.000000000 +0100 +++ konsole-22.12.3/src/session/Session.cpp 2023-07-25 22:03:35.518283329 +0200 @@ -537,6 +537,7 @@ if ((what == IconNameAndWindowTitle) || (what == WindowTitle)) { if (_userTitle != caption) { _userTitle = caption; + _displayTitle = caption; modified = true; } } I can confirm this bug is real and still exists in 23.08.4 and it's been an irritant for a while. Although, what I see might be slightly different than was originally described by Alain. With the "Tab title format" setting set to %w, when the title setting ANSI sequence is sent Konsole immediately changes the title on it's main window, then after a delay of approximately 2 seconds it sets the title on the Tab that initiated the change. I did some digging into the code before finding this bug report, and it seems that the delay may be tied to the _interactionTimer in SessionController.cpp. That timer has an interval of 2 seconds and it triggers SessionController::snapshot() which does some title manipulations. However, before going further down that path I tried a patch close to what Alain had and it worked for me, so I didn't go any further. Here's my patch: diff -w -ruN konsole-23.08.4/src/session/Session.cpp konsole-23.08.4-fixed/src/session/Session.cpp --- konsole-23.08.4/src/session/Session.cpp 2023-12-04 21:11:17.000000000 -0600 +++ konsole-23.08.4-fixed/src/session/Session.cpp 2024-03-03 14:25:26.251659531 -0600 @@ -613,6 +613,10 @@ _userTitle = caption; modified = true; } + if (_displayTitle != caption) { + _displayTitle = caption; + modified = true; + } } if ((what == IconNameAndWindowTitle) || (what == IconName)) { I dug into the konsole source code and isolated the 2 second delay issue to the following commit: https://invent.kde.org/utilities/konsole/-/commit/416941b7141ee6c81cc1f92592f24bcb426d51e1 What's happening is that SessionController::snapshot() is applying the actual tab title update and prior to the above commit the code was run every 500msec, which was fast enough to appear instantaneous. With the above commit the code is now only run every 2 seconds, which makes for the very noticeable and slow update. I should have also mentioned that I see this delayed updated behaviour on Gentoo Linux, on which I'm currently running konsole 23.08.5. My previously mentioned patch for 23.08.4, a slight variation on Alain's original patch, still works to resolve the issue in 23.08.5. |