Index: abstract_client.h =================================================================== --- abstract_client.h +++ abstract_client.h @@ -983,6 +983,8 @@ void setUnresponsive(bool unresponsive); virtual void setShortcutInternal(); + QString shortcutCaptionSuffix() const; + virtual void updateCaption() = 0; private: void handlePaletteChange(); Index: abstract_client.cpp =================================================================== --- abstract_client.cpp +++ abstract_client.cpp @@ -1750,4 +1750,12 @@ } } +QString AbstractClient::shortcutCaptionSuffix() const +{ + if (shortcut().isEmpty()) { + return QString(); + } + return QLatin1String(" {") + shortcut().toString() + QLatin1Char('}'); +} + } Index: autotests/integration/globalshortcuts_test.cpp =================================================================== --- autotests/integration/globalshortcuts_test.cpp +++ autotests/integration/globalshortcuts_test.cpp @@ -292,7 +292,6 @@ client->setShortcut(seq.toString()); QCOMPARE(client->shortcut(), seq); QVERIFY(!workspace()->shortcutAvailable(seq)); - QEXPECT_FAIL("", "Caption adjustment not yet implemented", Continue); QCOMPARE(client->caption(), QStringLiteral(" {Meta+Shift+Y}")); workspace()->activateClient(nullptr); Index: client.h =================================================================== --- client.h +++ client.h @@ -339,7 +339,7 @@ public Q_SLOTS: void closeWindow() override; - void updateCaption(); + void updateCaption() override; void evaluateWindowRules(); private Q_SLOTS: Index: client.cpp =================================================================== --- client.cpp +++ client.cpp @@ -1442,7 +1442,7 @@ if (clientMachine()->hostName() != ClientMachine::localhost() && !clientMachine()->isLocal()) machine_suffix = QLatin1String(" <@") + QString::fromUtf8(clientMachine()->hostName()) + QLatin1Char('>') + LRM; } - QString shortcut_suffix = !shortcut().isEmpty() ? (QLatin1String(" {") + shortcut().toString() + QLatin1Char('}')) : QString(); + QString shortcut_suffix = shortcutCaptionSuffix(); cap_suffix = machine_suffix + shortcut_suffix; auto fetchNameInternalPredicate = [this](const Client *cl) { return (!cl->isSpecialWindow() || cl->isToolbar()) && Index: shell_client.h =================================================================== --- shell_client.h +++ shell_client.h @@ -163,6 +163,7 @@ bool acceptsFocus() const override; void doMinimize() override; void doMove(int x, int y) override; + void updateCaption() override; private Q_SLOTS: void clientFullScreenChanged(bool fullScreen); @@ -236,6 +237,7 @@ int m_requestGeometryBlockCounter = 0; QRect m_blockedRequestGeometry; QString m_caption; + QString m_captionSuffix; bool m_compositingSetup = false; }; Index: shell_client.cpp =================================================================== --- shell_client.cpp +++ shell_client.cpp @@ -556,8 +556,20 @@ QString ShellClient::caption(bool full) const { - Q_UNUSED(full) - return m_caption; + QString caption = m_caption; + if (full) { + caption += m_captionSuffix; + } + return caption; +} + +void ShellClient::updateCaption() +{ + const QString oldSuffix = m_captionSuffix; + m_captionSuffix = shortcutCaptionSuffix(); + if (m_captionSuffix != oldSuffix) { + emit captionChanged(); + } } void ShellClient::closeWindow() Index: useractions.cpp =================================================================== --- useractions.cpp +++ useractions.cpp @@ -1826,6 +1826,7 @@ void AbstractClient::setShortcutInternal() { + updateCaption(); workspace()->clientShortcutUpdated(this); }