Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Source https://vas3k.ru/blog/touchbar/
# Add feature: show widget only when video is playing in Google Chrome
if application "Google Chrome" is running then
tell application "Google Chrome"
repeat with t in tabs of windows
tell t
if URL starts with "http://www.youtube.com/watch" or URL starts with "https://www.youtube.com/watch" then
set isPause to execute t javascript "document.getElementsByTagName('video')[0].paused;"
if isPause is false then
return text 1 thru -11 of (title of t as text)
end if
end if
end tell
end repeat
end tell
end if
return ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.