Retrieving the Current Wallpaper
Run the below with
// Import the bridge ObjC.import('Cocoa'); // Get a shared workspace sw = $.NSWorkspace.sharedWorkspace; // Get the first screen (yes, this is an NSArray) screen = $.NSScreen.screens.firstObject; // Log the pathname (NSURL) out $.NSLog(sw.desktopImageURLForScreen(screen).absoluteString)
If the above is a folder, you have to go into the Dock’s
desktoppicture.db database1 and take a look at what’s there in the
SQLite bindings, I haven’t yet had the time to pursue this in depth, other than the
data table doesn’t seem to keep track of what wallpaper is on what display if you have multiple monitors (although I suspect that the last entry is always for the primary display).