Skip my social media window when auto-closing tabs
- ID
72458fd- date
2024-02-28 08:12:29+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
37c39d4- message
Skip my social media window when auto-closing tabs- changed files
1 file, 9 additions, 1 deletion
Changed files
macos/close_tabs (2589) → macos/close_tabs (2890)
diff --git a/macos/close_tabs b/macos/close_tabs
index 0a6a9d3..f587751 100755
--- a/macos/close_tabs
+++ b/macos/close_tabs
@@ -22,6 +22,14 @@ function* tabGenerator() {
for (tab_index = tab_count - 1; tab_index >= 0; tab_index--) {
tab = window.tabs[tab_index];
+
+ // I have a window of social media sites that I always have open,
+ // and the last tab is Cohost so this script knows now to close
+ // Twitter/Facebook in that window.
+ if (tab_index === tab_count - 1 && tab.url().startsWith('https://cohost.org')) {
+ break;
+ }
+
yield [window_index, tab_index, tab.url()];
}
}
@@ -67,7 +75,7 @@ let remainingCount = 0;
for (const [window_index, tab_index, url] of tabGenerator()) {
if (isSafeToClose(url)) {
console.log(url);
- safari.windows[window_index].tabs[tab_index].close();
+ // safari.windows[window_index].tabs[tab_index].close();
closedCount += 1;
} else {
remainingCount += 1;