How to Close Tab in Chrome by Double Click on It?

Hi,

I can't find the relevant information on the forum.

I want to close specific tab in Chrome by double click on its area.

I know how to close the tab but I can't determine that the mouse was double clicked on tab area.

Please ask me if you need more information about my question.

Please help to solve this problem.

Thanks
Roman

Hey Roman,

Welcome to the forum!  :sunglasses:

Unfortunately there's not really good way to do what you want.

Keyboard Maestro cannot determine that you're clicking on a tab in Chrome – at least not directly – and you'll compromise normal mouse function.

You can play with a device trigger:

Device Trigger – Using Two Mouse Clicks.kmmacros (2.7 KB)
Keyboard Maestro Export

But this is very hit and miss for me, and as I said – it compromises normal mouse function.

-Chris

Hi Chris,

Thanks for answer.

Is there any way to detect the text under mouse cursor or X,Y coordinates of the cursor when I click on the tab area?

Do you know how to read tabs area location coordinates on the screen (maybe AppleScript)?

Thanks
Roman

Hey Roman,

Take a look at the (CurrentMouse)[token:CurrentMouse [Keyboard Maestro Wiki]] token and the other related mouse tokens.

The tab bar and its contained tabs can be read by AppleScript using System Events and UI-Scripting. Something like this:

tell application "System Events"
   tell application process "Google Chrome"
      tell (first window whose subrole is "AXStandardWindow")
         tell group 1
            tell group 1
               tell group 1
                  tell group 1
                     tell tab group 1
                        return {position, size}
                     end tell
                  end tell
               end tell
            end tell
         end tell
      end tell
   end tell
end tell

And yes – you can get the position and size of the buttons as well.

-Chris

Thanks, I will try.
Roman

I think it is better to buy a Logitech MX Master mouse and set one button to close the current tab.

An alternative could be a gesture trigger. Short movement with the mouse to the right while pressing cmd (with a modifier it is safer) The mouse can be anywhere.

Thanks for help, meanwhile I set Middle mouse button to close the current tab.

Thanks
Roman