Skip to content

Instantly share code, notes, and snippets.

@ChristoferK
Last active May 11, 2023 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChristoferK/b562a0baf0898bf4229f6af37faacf24 to your computer and use it in GitHub Desktop.
Save ChristoferK/b562a0baf0898bf4229f6af37faacf24 to your computer and use it in GitHub Desktop.
[Close Every Other Tab In All Browser Windows] A pair of scripts that close every other tab in all windows of a Chromium-based browser or Safari, leaving the currently active tab open by itself. #AppleScript #browser #Chromium #Chrome #Brave #Safari #close #tabs
--OR: tell app id "com.google.Chrome"
tell application id "com.brave.browser" to if it is ¬
running then tell every window to if (exists) ¬
then close (the tabs whose id ≠ my window 1's ¬
active tab's id)
tell application id "com.apple.Safari" to if running ¬
then tell windows to if (exists) then close ¬
(tabs where it ≠ current tab of my window 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment