Can I double-click to close chrome tabs

I would like an app in the dock to open and close when I double-click it. Is that possible?

Hi @erwin, I'll try to help you out.

Assuming I understand your goal correctly, closing Chrome tabs via clicking on an item in the Dock is achievable. We'll do this by leveraging the macOS Shortcuts app and AppleScript.

:information_source: Note
I didn't implement any "opening" Chrome tabs functionality because I don't fully understand how exactly you would like that to work. If you provide more details, I could provide further guidance.

Steps:

  1. Create a new Apple Shortcut in the macOS Shortcuts app.

  2. Add a Run AppleScript Action.

  3. Enter this AppleScript in the Run AppleScript Action:

    tell application "Google Chrome"
    	-- Loop through each window
    	repeat with w in every window
    		-- Get just the tabs for this one window
    		set tabList to every tab of w
    		-- Close them one by one
    		repeat with t in tabList
    			close t
    		end repeat
    	end repeat
    end tell
    

    At this stage, you should see this on your screen:

  4. Click on File → Add to Dock

  5. You should now see a new item in your Dock called "Close Chrome Tabs" and when clicked, all of the tabs in every window of Chrome will be closed.

I hope this helps.