Skip to content

Commit

Permalink
(#898) Added double click to close tabs feature from Thorium.
Browse files Browse the repository at this point in the history
  • Loading branch information
win32ss committed Dec 13, 2024
1 parent e00e1d0 commit cc316d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11635,6 +11635,10 @@ const FeatureEntry kFeatureEntries[] = {
"Disable the creaton of Crashpad processes. This will save a few megabytes of memory and force the use of the system exception handler.",
kOsWin,
SINGLE_VALUE_TYPE("disable-crashpad")},
{"double-click-close-tab",
"Double Click to Close Tab",
"Enables double clicking a tab to close it.",
kOsDesktop, SINGLE_VALUE_TYPE("double-click-close-tab")}
// TODO: move all Supermium-specific flags to new source file.
// NOTE: Adding a new flag requires adding a corresponding entry to enum
// "LoginCustomFlags" in tools/metrics/histograms/enums.xml. See "Flag
Expand Down
6 changes: 5 additions & 1 deletion chrome/browser/ui/views/tabs/tab.cc
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,11 @@ void Tab::OnMouseReleased(const ui::MouseEvent& event) {
// Close tab on middle click, but only if the button is released over the tab
// (normal windows behavior is to discard presses of a UI element where the
// releases happen off the element).
if (event.IsOnlyMiddleMouseButton()) {
if (event.IsOnlyMiddleMouseButton() ||
// Close tab on double click, mirror of IsOnlyMiddleMouseButton
// Based on gz83's work.
((event.IsOnlyLeftMouseButton() && event.GetClickCount() == 2) &&
base::CommandLine::ForCurrentProcess()->HasSwitch("double-click-close-tab"))) {
if (HitTestPoint(event.location())) {
controller_->CloseTab(this, CLOSE_TAB_FROM_MOUSE);
} else if (closing_) {
Expand Down

0 comments on commit cc316d2

Please sign in to comment.