Merge pull request #46 from bernsteining/Wallpaper_Changer_macOS

Wallpaper changer for macOS
This commit is contained in:
CedArctic 2020-05-04 15:51:43 +03:00 committed by GitHub
commit 3a7a7367da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,11 @@
# macOS Wallpaper Changer
This script launches Spotlight to launch Terminal.app in order to download a picture, and sets it as a wallpaper, in less than 3 seconds.
Feel free to change the image link in the script in order to set another image.
Changing the download path (/Users/Shared/wallpaper.jpg) may crash the AppleScript executed to change the wallpaper.
## How to change macOS Wallpaper with the Terminal
https://apple.stackexchange.com/questions/40644/how-do-i-change-desktop-background-with-a-terminal-command

View File

@ -0,0 +1,28 @@
// This script launches Spotlight to launch Terminal.app in order to download a picture, and sets it as a wallpaper, in less than 3 seconds.
// Tested on El Capitan (macOS 10.11.6)
#include "DigiKeyboard.h"
void setup() {
}
void loop() {
DigiKeyboard.sendKeyStroke(0);
DigiKeyboard.delay(200);
DigiKeyboard.sendKeyStroke(KEY_SPACE, MOD_GUI_LEFT);
DigiKeyboard.delay(200);
DigiKeyboard.print("Terminal");
DigiKeyboard.delay(200);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.delay(200);
DigiKeyboard.print("curl https://tr3.cbsistatic.com/hub/i/2014/05/15/f8964afd-bd82-4e0e-bcbe-e927363dcdc1/3b858e39e2cf183b878f54cad0073a67/codedoge.jpg > /Users/Shared/wallpaper.jpg");
DigiKeyboard.delay(500);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.print("osascript -e 'tell application \"Finder\" to set desktop picture to POSIX file \"/Users/Shared/wallpaper.jpg\"'");
DigiKeyboard.delay(200);
DigiKeyboard.sendKeyStroke(KEY_ENTER);
DigiKeyboard.delay(200);
DigiKeyboard.sendKeyStroke(KEY_Q, MOD_GUI_LEFT);
for (;;) {
/*Stops the digispark from running the scipt again*/
}
}