diff options
author | networkException <git@nwex.de> | 2022-07-10 17:32:05 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-14 13:17:33 +0200 |
commit | 101c5566cb45306c882dd6e51fabf6bf567aa832 (patch) | |
tree | 7b3d3ede8cff9ded0f3d215519c15d8b49796ea6 /Userland/Applications/Browser/Tab.cpp | |
parent | 6cd82f0100a67f70457fb66f0d744eecb93c0520 (diff) | |
download | serenity-101c5566cb45306c882dd6e51fabf6bf567aa832.zip |
Browser: Make "Go Home" open a new tab on middle mouse click
Diffstat (limited to 'Userland/Applications/Browser/Tab.cpp')
-rw-r--r-- | Userland/Applications/Browser/Tab.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index 3eb18c08b7..89c33cc29e 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -3,6 +3,7 @@ * Copyright (c) 2021, Maciej Zygmanowski <sppmacd@pm.me> * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org> * Copyright (c) 2022, the SerenityOS developers. + * Copyright (c) 2022, Jakob-Niklas See <git@nwex.de> * * SPDX-License-Identifier: BSD-2-Clause */ @@ -146,7 +147,12 @@ Tab::Tab(BrowserWindow& window) m_go_forward_context_menu->popup(context_menu_event.screen_position()); }; - toolbar.add_action(window.go_home_action()); + auto& go_home_button = toolbar.add_action(window.go_home_action()); + go_home_button.set_allowed_mouse_buttons_for_pressing(GUI::MouseButton::Primary | GUI::MouseButton::Middle); + go_home_button.on_middle_mouse_click = [&](auto) { + on_tab_open_request(Browser::url_from_user_input(g_home_url)); + }; + toolbar.add_action(window.reload_action()); m_location_box = toolbar.add<GUI::UrlBox>(); |