Last active
April 4, 2022 12:48
-
-
Save jschoolcraft/01b46b3231adb3c68b53b4569b4939e0 to your computer and use it in GitHub Desktop.
Revisions
-
Jeff Schoolcraft revised this gist
Apr 4, 2022 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,6 +17,5 @@ end exit unless tabs.size > 0 tabs.uniq.sort.each { |title, url| puts format("* [%s](%s)", title, url) } -
Jeff Schoolcraft created this gist
Apr 2, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #!/usr/bin/env ruby # stolen from https://superuser.com/questions/489207/get-the-currently-open-tabs-in-google-chrome-via-the-command-line window_count = %x(osascript -e 'tell application "Brave Browser" to get number of windows').to_i exit if window_count == 0 tabs = [] 1.upto(window_count).each do |win| tab_count = %x(osascript -e 'tell application \"Brave Browser\" to get number of tabs in window #{win}').to_i next unless tab_count > 0 1.upto(tab_count) do |tab| title,url = %x(osascript -e 'tell application \"Brave Browser\" to get {title,URL} of tab #{tab} of window #{win}').split(/,/).map(&:strip) tabs << [title, url] end end exit unless tabs.size > 0 tabs.uniq!.sort! tabs.each { |title, url| puts format("* [%s](%s)", title, url) }