diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index 9429f88fe0..4f2f3e6d91 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -542,6 +542,14 @@ void BrowserWindow::create_new_tab(URL url, bool activate) }); }; + new_tab.on_tab_close_other_request = [this](auto& tab) { + m_tab_widget->deferred_invoke([this, &tab](auto&) { + m_tab_widget->remove_all_tabs_except(tab); + VERIFY(m_tab_widget->children().size() == 1); + m_tab_widget->set_bar_visible(false); + }); + }; + new_tab.on_get_cookie = [this](auto& url, auto source) -> String { return m_cookie_jar.get_cookie(url, source); }; diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index aa7fe0bc53..b8f2527d56 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -337,6 +337,12 @@ Tab::Tab(BrowserWindow& window, Type type) m_tab_context_menu->add_action(GUI::Action::create("&Close Tab", [this](auto&) { on_tab_close_request(*this); })); + m_tab_context_menu->add_action(GUI::Action::create("&Duplicate Tab", [this](auto&) { + on_tab_open_request(url()); + })); + m_tab_context_menu->add_action(GUI::Action::create("Close &Other Tabs", [this](auto&) { + on_tab_close_other_request(*this); + })); m_page_context_menu = GUI::Menu::construct(); m_page_context_menu->add_action(window.go_back_action()); diff --git a/Userland/Applications/Browser/Tab.h b/Userland/Applications/Browser/Tab.h index 48f360f0fd..8e4cb93ee8 100644 --- a/Userland/Applications/Browser/Tab.h +++ b/Userland/Applications/Browser/Tab.h @@ -58,6 +58,7 @@ public: Function on_title_change; Function on_tab_open_request; Function on_tab_close_request; + Function on_tab_close_other_request; Function on_favicon_change; Function on_get_cookie; Function on_set_cookie;