sindresorhus / wallpaper

Manage the desktop wallpaper
MIT License
1.05k stars 91 forks source link

Returns folder instead of file on Mac OS X (when a folder is selected, and "change picture" is selected) #4

Closed sg-s closed 8 years ago

sg-s commented 9 years ago

running wallpaper returns the path of the folder that contains the current wallpaper, instead of the path to the actual file.

this issue is true whether or not multiple desktops are enabled.

sindresorhus commented 9 years ago

Can you try setting a wallpaper through System Preferences and see if it's still a folder? OS X version?

sg-s commented 9 years ago

hi, i did set the wallpaper using System Preferences. I'm on Mac OS X 10.10.3. node: v0.12.2

sg-s commented 9 years ago

ah ha! i misunderstood your question — it is set to a folder in System Preferences. But shouldn't the expected behaviour be to return the path to the current wallpaper?

sindresorhus commented 9 years ago

Ah, right. Was able reproduce it now when I selected "Change picture". The problem is that I'm using the blessed OS X API to get the wallpaper, so not sure there's much to do about it. I agree it's suboptimal.

I made this mainly for being able to set the wallpaper though, and just added a getter for convenience.

I'd say PR welcome here, but not a priority for me.

Seems like this returns the correct wallpaper, though would prefer an Objective-C solution:

tell application "Finder" to POSIX path of (desktop picture as alias)

Another lead: http://stackoverflow.com/questions/14099363/get-the-current-wallpaper-in-cocoa

sg-s commented 9 years ago

thanks — i guess it's too complicated for now