From 2b2dbdfd4edd695e8604cba2e8b96481250ba85e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Javier=20Merino=20Mor=C3=A1n?= Date: Fri, 7 Jan 2022 22:28:42 +0100 Subject: [PATCH] Make %w and %# work for bell notifications Since commit c3982cfb, bell notifications include the display title, in addition to the name title, to help identifying which tab the notification came from. Unfortunately, %w (which can be quite useful in identifying tabs) and %# weren't working for this case, neither for the DBUS query: qdbus $KONSOLE_DBUS_SERVICE $KONSOLE_DBUS_SESSION org.kde.konsole.Session.title 1 BUG: 435644 --- src/session/Session.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/session/Session.cpp b/src/session/Session.cpp index f6f9067f..0035dad0 100644 --- a/src/session/Session.cpp +++ b/src/session/Session.cpp @@ -1104,7 +1104,10 @@ QString Session::getDynamicTitle() bool ok = false; if (process->name(&ok) == QLatin1String("ssh") && ok) { SSHProcessInfo sshInfo(*process); - return sshInfo.format(tabTitleFormat(Session::RemoteTabTitle)); + QString title = tabTitleFormat(Session::RemoteTabTitle); + title.replace(QLatin1String("%w"), userTitle()); + title.replace(QLatin1String("%#"), QString::number(sessionId())); + return sshInfo.format(title); } /* @@ -1124,6 +1127,9 @@ QString Session::getDynamicTitle() * 'bob' would be returned) * *
  • %D - Replaced with the current working directory of the process.
  • + *
  • %h - Replaced with the local host name.
  • + *
  • %w - Replaced with the window title set by the shell.
  • + *
  • %# - Replaced with the number of the session.
  • * */ QString title = tabTitleFormat(Session::LocalTabTitle); @@ -1145,6 +1151,9 @@ QString Session::getDynamicTitle() title.replace(QLatin1String("%h"), Konsole::ProcessInfo::localHost()); title.replace(QLatin1String("%n"), process->name(&ok)); + title.replace(QLatin1String("%w"), userTitle()); + title.replace(QLatin1String("%#"), QString::number(sessionId())); + QString dir = _reportedWorkingUrl.toLocalFile(); ok = true; if (dir.isEmpty()) {