Get the current file path location of the currently selected macOS Wallpaper
// Return an NSURL to the location
NSURL* url = [SKWallPaper getCurrentWallpaperPath:[NSScreen mainScreen]];
// Setting a wallpaper
NSScreen* screen = [NSScreen mainScreen];
NSError* fail = [SKWallPaper setWallpaperForScreen:@"/Users/username_here/path_to_image/image_name_here.jpg":screen];
if (fail != nil) {
NSLog(@"%@\n", [fail localizedFailureReason]);
} else {
NSLog(@"Done!");
}
Follow this tutorial to find out more
See LICENSE for more details. Copyright (c) 2024, Mustafa Malik.