diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index 56bfff9c82..292cced932 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -103,6 +103,10 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url) create_new_tab(Browser::url_from_user_input(Browser::g_new_tab_url), true); }; + m_window_actions.on_create_new_window = [this] { + GUI::Process::spawn_or_show_error(this, "/bin/Browser"sv); + }; + m_window_actions.on_next_tab = [this] { m_tab_widget->activate_next_tab(); }; @@ -154,6 +158,7 @@ void BrowserWindow::build_menus() { auto& file_menu = add_menu("&File"); file_menu.add_action(WindowActions::the().create_new_tab_action()); + file_menu.add_action(WindowActions::the().create_new_window_action()); auto close_tab_action = GUI::CommonActions::make_close_tab_action([this](auto&) { active_tab().on_tab_close_request(active_tab()); diff --git a/Userland/Applications/Browser/WindowActions.cpp b/Userland/Applications/Browser/WindowActions.cpp index 68a22afc89..c6ee0613d7 100644 --- a/Userland/Applications/Browser/WindowActions.cpp +++ b/Userland/Applications/Browser/WindowActions.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2020, Andreas Kling + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -32,6 +33,15 @@ WindowActions::WindowActions(GUI::Window& window) &window); m_create_new_tab_action->set_status_tip("Open a new tab"); + m_create_new_window_action = GUI::Action::create( + "&New Window", { Mod_Ctrl, Key_N }, g_icon_bag.go_to, [this](auto&) { + if (on_create_new_window) { + on_create_new_window(); + } + }, + &window); + m_create_new_window_action->set_status_tip("Open a new browser window"); + m_next_tab_action = GUI::Action::create( "&Next Tab", { Mod_Ctrl, Key_PageDown }, [this](auto&) { if (on_next_tab) diff --git a/Userland/Applications/Browser/WindowActions.h b/Userland/Applications/Browser/WindowActions.h index 0c208a642d..fb2a70335e 100644 --- a/Userland/Applications/Browser/WindowActions.h +++ b/Userland/Applications/Browser/WindowActions.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2020, Andreas Kling + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -17,6 +18,7 @@ public: WindowActions(GUI::Window&); Function on_create_new_tab; + Function on_create_new_window; Function on_next_tab; Function on_previous_tab; Vector> on_tabs; @@ -25,6 +27,7 @@ public: Function on_vertical_tabs; GUI::Action& create_new_tab_action() { return *m_create_new_tab_action; } + GUI::Action& create_new_window_action() { return *m_create_new_window_action; } GUI::Action& next_tab_action() { return *m_next_tab_action; } GUI::Action& previous_tab_action() { return *m_previous_tab_action; } GUI::Action& about_action() { return *m_about_action; } @@ -33,6 +36,7 @@ public: private: RefPtr m_create_new_tab_action; + RefPtr m_create_new_window_action; RefPtr m_next_tab_action; RefPtr m_previous_tab_action; NonnullRefPtrVector m_tab_actions; diff --git a/Userland/Applications/Browser/main.cpp b/Userland/Applications/Browser/main.cpp index 5168b37785..393c45359e 100644 --- a/Userland/Applications/Browser/main.cpp +++ b/Userland/Applications/Browser/main.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2018-2021, Andreas Kling * Copyright (c) 2022, Sam Atkins + * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -91,6 +92,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/etc/passwd", "r")); TRY(Core::System::unveil("/etc/timezone", "r")); TRY(Core::System::unveil("/bin/BrowserSettings", "x")); + TRY(Core::System::unveil("/bin/Browser", "x")); TRY(Core::System::unveil(nullptr, nullptr)); Web::ResourceLoader::initialize(TRY(WebView::RequestServerAdapter::try_create()));