From 4c3a716556d85ef5b95f841c99352dfa75f84c71 Mon Sep 17 00:00:00 2001 From: saberoueslati Date: Sun, 26 Apr 2026 02:55:32 +0100 Subject: [PATCH 1/2] helium/linux: middle-click on empty tab strip opens new tab --- ...e-click-empty-tabstrip-opens-new-tab.patch | 81 +++++++++++++++++++ patches/series | 1 + 2 files changed, 82 insertions(+) create mode 100644 patches/helium/linux/middle-click-empty-tabstrip-opens-new-tab.patch diff --git a/patches/helium/linux/middle-click-empty-tabstrip-opens-new-tab.patch b/patches/helium/linux/middle-click-empty-tabstrip-opens-new-tab.patch new file mode 100644 index 0000000..cae5dc6 --- /dev/null +++ b/patches/helium/linux/middle-click-empty-tabstrip-opens-new-tab.patch @@ -0,0 +1,81 @@ +--- a/chrome/browser/ui/views/tabs/tab_strip.h ++++ b/chrome/browser/ui/views/tabs/tab_strip.h +@@ -401,6 +401,8 @@ class TabStrip : public views::View, + // views::View: + void OnMouseEntered(const ui::MouseEvent& event) override; + void OnMouseExited(const ui::MouseEvent& event) override; ++ bool OnMousePressed(const ui::MouseEvent& event) override; ++ void OnMouseReleased(const ui::MouseEvent& event) override; + void AddedToWidget() override; + void RemovedFromWidget() override; + void OnThemeChanged() override; +--- a/chrome/browser/ui/views/tabs/tab_strip.cc ++++ b/chrome/browser/ui/views/tabs/tab_strip.cc +@@ -2443,6 +2443,21 @@ void TabStrip::OnMouseExited(const ui::MouseEvent& event) { + UpdateHoverCard(nullptr, HoverCardUpdateType::kHover); + } + ++bool TabStrip::OnMousePressed(const ui::MouseEvent& event) { ++ if (event.IsOnlyMiddleMouseButton() && !GetTabAt(event.location())) { ++ return true; ++ } ++ return views::View::OnMousePressed(event); ++} ++ ++void TabStrip::OnMouseReleased(const ui::MouseEvent& event) { ++ if (event.IsOnlyMiddleMouseButton() && !GetTabAt(event.location())) { ++ controller_->CreateNewTab(NewTabTypes::kNewTabButton); ++ return; ++ } ++ views::View::OnMouseReleased(event); ++} ++ + void TabStrip::AddedToWidget() { + GetWidget()->AddObserver(this); + paint_as_active_subscription_ = +--- a/chrome/browser/ui/views/frame/horizontal_tab_strip_region_view.cc ++++ b/chrome/browser/ui/views/frame/horizontal_tab_strip_region_view.cc +@@ -26,6 +26,7 @@ + #include "chrome/browser/ui/tabs/tab_menu_model.h" + #include "chrome/browser/ui/tabs/tab_strip_model.h" + #include "chrome/browser/ui/tabs/tab_strip_prefs.h" ++#include "chrome/browser/ui/tabs/tab_enums.h" + #include "chrome/browser/ui/ui_features.h" + #include "chrome/browser/ui/views/chrome_layout_provider.h" + #include "chrome/browser/ui/views/frame/browser_view.h" +@@ -106,6 +107,21 @@ class FrameGrabHandle : public views::View { + return gfx::Size(27, 0); + } + ++ bool OnMousePressed(const ui::MouseEvent& event) override { ++ if (event.IsOnlyMiddleMouseButton()) { ++ return true; ++ } ++ return views::View::OnMousePressed(event); ++ } ++ ++ void OnMouseReleased(const ui::MouseEvent& event) override { ++ if (event.IsOnlyMiddleMouseButton() && tab_strip_) { ++ tab_strip_->controller()->CreateNewTab(NewTabTypes::kNewTabButton); ++ return; ++ } ++ views::View::OnMouseReleased(event); ++ } ++ + private: + base::WeakPtr tab_strip_; + }; +--- a/ui/views/widget/desktop_aura/window_event_filter_linux.cc ++++ b/ui/views/widget/desktop_aura/window_event_filter_linux.cc +@@ -118,9 +118,9 @@ void WindowEventFilterLinux::OnClickedCaption(ui::MouseEvent* event, + if (event->changed_button_flags() & ui::EF_RIGHT_MOUSE_BUTTON) { + action_type = ui::LinuxUi::WindowFrameActionSource::kRightClick; + default_action = ui::LinuxUi::WindowFrameAction::kMenu; + } else if (event->changed_button_flags() & ui::EF_MIDDLE_MOUSE_BUTTON) { +- action_type = ui::LinuxUi::WindowFrameActionSource::kMiddleClick; +- default_action = ui::LinuxUi::WindowFrameAction::kNone; ++ // Let the views hierarchy handle middle click (e.g. tab strip opens new tab). ++ return; + } else if (event->changed_button_flags() & ui::EF_LEFT_MOUSE_BUTTON && + event->flags() & ui::EF_IS_DOUBLE_CLICK) { + click_component_ = HTNOWHERE; diff --git a/patches/series b/patches/series index 5808fa9..53ca306 100644 --- a/patches/series +++ b/patches/series @@ -2,6 +2,7 @@ ungoogled-chromium/portablelinux/drop-nodejs-version-check.patch ungoogled-chromium/portablelinux/use-oauth2-client-switches-as-default.patch ungoogled-chromium/portablelinux/fix-compiling-on-arm64.patch +helium/linux/middle-click-tab-strip-opens-new-tab.patch helium/linux/change-chromium-branding.patch helium/linux/rename-chrome-binary.patch helium/linux/use-default-theme.patch From 9f133b93ada07c3d5b2a5970e90ead7fef95fb32 Mon Sep 17 00:00:00 2001 From: saberoueslati Date: Sun, 26 Apr 2026 03:23:15 +0100 Subject: [PATCH 2/2] Corrected name of the patch --- patches/series | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/series b/patches/series index 53ca306..68fbc2b 100644 --- a/patches/series +++ b/patches/series @@ -2,7 +2,7 @@ ungoogled-chromium/portablelinux/drop-nodejs-version-check.patch ungoogled-chromium/portablelinux/use-oauth2-client-switches-as-default.patch ungoogled-chromium/portablelinux/fix-compiling-on-arm64.patch -helium/linux/middle-click-tab-strip-opens-new-tab.patch +helium/linux/middle-click-empty-tabstrip-opens-new-tab.patch helium/linux/change-chromium-branding.patch helium/linux/rename-chrome-binary.patch helium/linux/use-default-theme.patch