SjoenH / keyboard-goat-dongle

An Arduino-based USB dongle that emulates a keyboard to send playful goat messages and remind users to lock their computers.
0 stars 0 forks source link

Change Desktop Background to Goat Image #3

Open SjoenH opened 2 months ago

SjoenH commented 2 months ago

Description

Implement a prank that changes the desktop background to a goat image using an Arduino USB dongle. The image should be downloaded from a remote server using curl or wget and set as the wallpaper on macOS.

Example Implementation

void changeDesktopBackground() {
    // Command to download the goat image
    Keyboard.print("curl -o /tmp/goat.jpg http://example.com/goat.jpg");
    Keyboard.press(KEY_RETURN);
    delay(1000);

    // Command to change the desktop background
    Keyboard.print("osascript -e 'tell application \"Finder\" to set desktop picture to POSIX file \"/tmp/goat.jpg\"'");
    Keyboard.press(KEY_RETURN);
    delay(1000);
}
SjoenH commented 2 months ago

Mac

First open Terminal app. Then type:

wget -O /tmp/goat.jpg https://wallpapercave.com/wp/wp9348729.jpg && osascript -e 'tell application "System Events" to set picture of desktop 1 to POSIX file "/tmp/goat.jpg"'

Windows

Invoke-WebRequest -Uri https://wallpapercave.com/wp/wp9348729.jpg -OutFile C:\Temp\goat.jpg
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class Wallpaper {
    [DllImport("user32.dll", CharSet = CharSet.Auto)]
    public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
}
"@
[Wallpaper]::SystemParametersInfo(20, 0, "C:\Temp\goat.jpg", 3)