Last active
October 4, 2018 02:58
-
-
Save brantwedel/db3f231c6d63ac677972e9be5f90aef6 to your computer and use it in GitHub Desktop.
TouchBar "Dock" using Better Touch Tool
This file contains 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 characters
# cycle through Google Chrome tabs and windows | |
tell application "System Events" | |
set activeApp to name of first application process whose frontmost is true | |
try | |
set activeChrome to first application process whose name is "Google Chrome" | |
set appName to name of window 1 of activeChrome | |
on error errMsg | |
tell application "Google Chrome" to make new window | |
tell application "Google Chrome" to activate | |
return | |
end try | |
if "Google Chrome" is not in activeApp then | |
tell application "Google Chrome" to activate | |
return | |
end if | |
end tell | |
tell application "Google Chrome" | |
set firstWIndow to -1 | |
set firstIndex to -1 | |
set nextWindow to -1 | |
set nextIndex to -1 | |
repeat with w in windows | |
set i to 1 | |
set found to -1 | |
repeat with t in tabs of w | |
# if URL of t starts with "" then | |
if firstWIndow is equal to -1 then | |
set firstWIndow to w | |
set firstIndex to i | |
end if | |
if (i is greater than active tab index of w or w is not firstWIndow) and nextWindow is equal to -1 then | |
set nextWindow to w | |
set nextIndex to i | |
end if | |
# end if | |
set i to i + 1 | |
end repeat | |
end repeat | |
if nextWindow is not -1 then | |
set active tab index of nextWindow to nextIndex | |
set index of nextWindow to 1 | |
return | |
end if | |
if firstWIndow is not -1 then | |
set active tab index of firstWIndow to firstIndex | |
set index of firstWIndow to 1 | |
return | |
end if | |
end tell |
This file contains 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 characters
try | |
tell application "System Events" | |
set activeApp to name of first application process whose frontmost is true | |
if "Google Chrome" is activeApp then | |
return " " | |
else | |
return activeApp | |
end if | |
end tell | |
end try | |
return " " |
This file contains 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 characters
# check if Finder is active, change for desired app | |
try | |
tell application "System Events" | |
set activeApp to name of first application process whose frontmost is true | |
if "Finder" is activeApp then | |
return " " | |
end if | |
end tell | |
end try | |
return " " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment