Created
October 30, 2015 20:31
-
-
Save cletusw/bcbd8d2d0559f9ab56fc to your computer and use it in GitHub Desktop.
Change your background at a specific time (Mac OS X). Use `crontab -e` to edit your crontab:
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 characters
0 10 * * * osascript ~/bin/Flow.scpt | |
0 12 * * * osascript ~/bin/No\ Flow.scpt | |
30 14 * * * osascript ~/bin/Flow.scpt | |
30 16 * * * osascript ~/bin/No\ Flow.scpt |
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 characters
tell application "Finder" | |
-- wrapped in a try block for error suppression | |
try | |
set mainDisplayPicture to "/Users/claytonwatts/Pictures/Flow.jpg" | |
-- set the picture for additional monitors, if applicable | |
tell application "System Events" | |
-- get a reference to all desktops | |
set theDesktops to a reference to every desktop | |
-- handle additional desktops | |
if ((count theDesktops) > 1) then | |
-- loop through all desktops (beginning with the second desktop) | |
repeat with x from 1 to (count theDesktops) | |
-- apply image to desktop | |
set picture of item x of the theDesktops to mainDisplayPicture | |
end repeat | |
end if | |
end tell | |
end try | |
end tell |
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 characters
tell application "Finder" | |
-- wrapped in a try block for error suppression | |
try | |
set mainDisplayPicture to "/Users/claytonwatts/Pictures/No Flow.jpg" | |
-- set the picture for additional monitors, if applicable | |
tell application "System Events" | |
-- get a reference to all desktops | |
set theDesktops to a reference to every desktop | |
-- handle additional desktops | |
if ((count theDesktops) > 1) then | |
-- loop through all desktops (beginning with the second desktop) | |
repeat with x from 1 to (count theDesktops) | |
-- apply image to desktop | |
set picture of item x of the theDesktops to mainDisplayPicture | |
end repeat | |
end if | |
end tell | |
end try | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment