Last active
December 3, 2024 11:20
-
-
Save forkloop/163739904e4d4647ce04 to your computer and use it in GitHub Desktop.
Set desktop background to given a picture URL
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
| #!/usr/bin/osascript | |
| on run(argv) | |
| if count of argv is equal to 0 then | |
| set msg to "Usage\n\tset_bg URI" | |
| return msg | |
| end if | |
| set uri to item 1 of argv | |
| set dest to do shell script "echo /tmp/$(date +%Y%m%d%H%M%S).jpg" | |
| set cmd to "curl -L " & uri & " > " & dest | |
| do shell script cmd | |
| tell application "Finder" | |
| set desktop picture to POSIX file dest | |
| end tell | |
| end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment