diff --git a/CHANGELOG.md b/CHANGELOG.md index e34a29f3..75c80514 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ - Minor: Opening streamlink through hotkeys and/or split header menu matches `/streamlink` command and shows feedback in chat as well. (#3510) - Minor: Removed timestamp from AutoMod messages. (#3503) - Minor: Added ability to copy message ID with `Shift + Right Click`. (#3481) +- Minor: Added /popup command to open currently focused split or supplied channel in a new window. (#3529) - Minor: Colorize the entire split header when focused. (#3379) - Minor: Added incremental search to channel search. (#3544) - Minor: Show right click context menu anywhere within a message's line. (#3566) diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index 544df68c..4a062586 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -685,6 +685,51 @@ void CommandController::initialize(Settings &, Paths &paths) return ""; }); + this->registerCommand("/popup", [](const QStringList &words, + ChannelPtr channel) { + static const auto *usageMessage = + "Usage: /popup [channel]. Open specified Twitch channel in " + "a new window. If no channel argument is specified, open " + "the currently selected split instead."; + + QString target(words.value(1)); + stripChannelName(target); + + if (target.isEmpty()) + { + auto *currentPage = + dynamic_cast(getApp() + ->windows->getMainWindow() + .getNotebook() + .getSelectedPage()); + if (currentPage != nullptr) + { + auto *currentSplit = currentPage->getSelectedSplit(); + if (currentSplit != nullptr) + { + currentSplit->popup(); + + return ""; + } + } + + channel->addMessage(makeSystemMessage(usageMessage)); + return ""; + } + + auto *app = getApp(); + Window &window = app->windows->createWindow(WindowType::Popup, true); + + auto *split = new Split(static_cast( + window.getNotebook().getOrAddSelectedPage())); + + split->setChannel(app->twitch.server->getOrAddChannel(target)); + + window.getNotebook().getOrAddSelectedPage()->appendSplit(split); + + return ""; + }); + this->registerCommand("/clearmessages", [](const auto & /*words*/, ChannelPtr channel) { auto *currentPage = dynamic_cast(