Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lacostenycoder
Last active January 30, 2017 01:28
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 lacostenycoder/01108de10fe02e2f39d9cceb2457b895 to your computer and use it in GitHub Desktop.
Save lacostenycoder/01108de10fe02e2f39d9cceb2457b895 to your computer and use it in GitHub Desktop.
Hack to avoid white flashes new tabs on Chrome (night mode)
on run {input, parameters}
set the_application to (path to frontmost application as Unicode text)
repeat 5 times
tell application "System Events"
key code 107
end tell
end repeat
delay 1
tell application "System Events"
keystroke "t" using command down
delay 1
end tell
delay 1
repeat 5 times
tell application "System Events"
key code 113
end tell
end repeat
return input
end run
@lacostenycoder
Copy link
Author

This hack requires installing Spectacle as it relies on a keyboard shortcut to restore full screen.
The hack above should be added as a Service using Apple Automator.
Finally, once the service has been added with: Service receives 'no input' in Goggle Chrome
flashhack

You can add a keyboard shortcut in System Preferences to your FlashHack or whatever you name your script.
So far it works ok but occasionally opens a tab without a url bar. Perhaps changing the delays might help.

Please leave comments if you find this helpful or any improvements, thanks!

@lacostenycoder
Copy link
Author

Updated code to no longer rely on resizing screen at that was too buggy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment