diff --git a/src/widgets/notebook.cpp b/src/widgets/notebook.cpp index e8f491f9b..b1d7d3501 100644 --- a/src/widgets/notebook.cpp +++ b/src/widgets/notebook.cpp @@ -4,6 +4,7 @@ #include "singletons/windowmanager.hpp" #include "widgets/helper/notebookbutton.hpp" #include "widgets/helper/notebooktab.hpp" +#include "widgets/helper/shortcut.hpp" #include "widgets/settingsdialog.hpp" #include "widgets/splitcontainer.hpp" #include "widgets/window.hpp" @@ -51,6 +52,16 @@ Notebook::Notebook(Window *parent, bool _showButtons) closeConfirmDialog.setDefaultButton(QMessageBox::Yes); this->scaleChangedEvent(this->getScale()); + + // Window-wide hotkeys + // CTRL+T: Create new split in selected notebook page + CreateWindowShortcut(this, "CTRL+T", [this]() { + if (this->selectedPage == nullptr) { + return; + } + + this->selectedPage->addChat(true); + }); } SplitContainer *Notebook::addNewPage(bool select) diff --git a/src/widgets/split.cpp b/src/widgets/split.cpp index 21d952aae..89cbea395 100644 --- a/src/widgets/split.cpp +++ b/src/widgets/split.cpp @@ -58,9 +58,6 @@ Split::Split(SplitContainer *parent) this->vbox.addWidget(&this->input); // Initialize chat widget-wide hotkeys - // CTRL+T: Create new split (Add page) - CreateShortcut(this, "CTRL+T", &Split::doAddSplit); - // CTRL+W: Close Split CreateShortcut(this, "CTRL+W", &Split::doCloseSplit); diff --git a/src/widgets/split.hpp b/src/widgets/split.hpp index ddd71416b..f5195a549 100644 --- a/src/widgets/split.hpp +++ b/src/widgets/split.hpp @@ -101,7 +101,7 @@ private: public slots: // Add new split to the notebook page that this chat widget is in - // Maybe we should use this chat widget as a hint to where the new split should be created + // This is only activated from the menu now. Hotkey is handled in Notebook void doAddSplit(); // Close current split (chat widget)