From 0b4e2312ff2f6e91a7de1f28bec223a4e57c71a3 Mon Sep 17 00:00:00 2001 From: Supa <36031171+0Supa@users.noreply.github.com> Date: Sat, 15 Nov 2025 15:24:13 +0200 Subject: [PATCH] feat: add setting to show title in live message (#6572) Reviewed-by: pajlada --- CHANGELOG.md | 1 + .../notifications/NotificationController.cpp | 3 ++- src/messages/MessageBuilder.cpp | 21 ++++++++++++++++--- src/messages/MessageBuilder.hpp | 1 + src/providers/twitch/TwitchChannel.cpp | 1 + src/singletons/Settings.hpp | 4 ++++ src/widgets/settingspages/GeneralPage.cpp | 7 +++++++ 7 files changed, 34 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 089d343b..2b676145 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Minor: Consolidate font picking into one dialog. (#6531) - Minor: Added a menu action to sort tabs alphabetically. (#6551) - Minor: Fixed "edit hotkey" dialog opening like a normal window. (#6540) +- Minor: Added a setting to show the stream title in live messages. (#6572) - Bugfix: Expose the "Extra extension IDs" setting on non-Windows systems too. (#6509) - Bugfix: Fixed some commands and filters not working as expected in seach popups. (#6539) - Bugfix: Fixed settings occasionally not opening when clicking on "Manage Accounts" in the account switcher. (#6543) diff --git a/src/controllers/notifications/NotificationController.cpp b/src/controllers/notifications/NotificationController.cpp index eccf7cc8..8e229d8c 100644 --- a/src/controllers/notifications/NotificationController.cpp +++ b/src/controllers/notifications/NotificationController.cpp @@ -138,7 +138,8 @@ void NotificationController::notifyTwitchChannelLive( // Message in /live channel getApp()->getTwitch()->getLiveChannel()->addMessage( - MessageBuilder::makeLiveMessage(payload.displayName, payload.channelId), + MessageBuilder::makeLiveMessage(payload.displayName, payload.channelId, + payload.title), MessageContext::Original); // Notify on all channels with a ping sound diff --git a/src/messages/MessageBuilder.cpp b/src/messages/MessageBuilder.cpp index de096163..594d883b 100644 --- a/src/messages/MessageBuilder.cpp +++ b/src/messages/MessageBuilder.cpp @@ -1153,6 +1153,7 @@ MessagePtr MessageBuilder::makeChannelPointRewardMessage( MessagePtr MessageBuilder::makeLiveMessage(const QString &channelName, const QString &channelID, + const QString &title, MessageFlags extraFlags) { MessageBuilder builder; @@ -1162,9 +1163,23 @@ MessagePtr MessageBuilder::makeLiveMessage(const QString &channelName, .emplace(channelName, MessageElementFlag::Username, MessageColor::Text, FontStyle::ChatMediumBold) ->setLink({Link::UserInfo, channelName}); - builder.emplace("is live!", MessageElementFlag::Text, - MessageColor::Text); - auto text = QString("%1 is live!").arg(channelName); + + QString text; + if (getSettings()->showTitleInLiveMessage) + { + text = QString("%1 is live: %2").arg(channelName, title); + builder.emplace("is live:", MessageElementFlag::Text, + MessageColor::Text); + builder.emplace(title, MessageElementFlag::Text, + MessageColor::Text); + } + else + { + text = QString("%1 is live!").arg(channelName); + builder.emplace("is live!", MessageElementFlag::Text, + MessageColor::Text); + } + builder.message().messageText = text; builder.message().searchText = text; builder.message().id = channelID; diff --git a/src/messages/MessageBuilder.hpp b/src/messages/MessageBuilder.hpp index cfd6bffc..0476f346 100644 --- a/src/messages/MessageBuilder.hpp +++ b/src/messages/MessageBuilder.hpp @@ -175,6 +175,7 @@ public: /// Make a "CHANNEL_NAME has gone live!" message static MessagePtr makeLiveMessage(const QString &channelName, const QString &channelID, + const QString &title, MessageFlags extraFlags = {}); // Messages in normal chat for channel stuff diff --git a/src/providers/twitch/TwitchChannel.cpp b/src/providers/twitch/TwitchChannel.cpp index 6cae7942..57ef24fb 100644 --- a/src/providers/twitch/TwitchChannel.cpp +++ b/src/providers/twitch/TwitchChannel.cpp @@ -641,6 +641,7 @@ void TwitchChannel::onLiveStatusChanged(bool isLive, bool isInitialUpdate) this->addMessage( MessageBuilder::makeLiveMessage( this->getDisplayName(), this->roomId(), + this->accessStreamStatus()->title, {MessageFlag::System, MessageFlag::DoNotTriggerNotification}), MessageContext::Original); } diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index aa4eea5b..e61ddcc9 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -691,6 +691,10 @@ public: true}; BoolSetting lockNotebookLayout = {"/misc/lockNotebookLayout", false}; BoolSetting showPronouns = {"/misc/showPronouns", false}; + BoolSetting showTitleInLiveMessage = { + "/extraChannels/live/showTitle", + false, + }; /// UI diff --git a/src/widgets/settingspages/GeneralPage.cpp b/src/widgets/settingspages/GeneralPage.cpp index 81ae2793..4822a6e2 100644 --- a/src/widgets/settingspages/GeneralPage.cpp +++ b/src/widgets/settingspages/GeneralPage.cpp @@ -1285,6 +1285,13 @@ void GeneralPage::initLayout(GeneralPageView &layout) R"(Pronouns are retrieved from pr.alejo.io when a user card is opened.)") ->addTo(layout); + SettingWidget::checkbox("Show stream title in live message", + s.showTitleInLiveMessage) + ->setTooltip("The title in the message will be the title the streamer " + "set when they went live, and will not update as the " + "streamer updates their title.") + ->addTo(layout); + SettingWidget::checkbox("Bold @usernames", s.boldUsernames) ->setTooltip("Bold @mentions to make them more noticeable.") ->addTo(layout);