NghiaTranUIT / artify-macos

🌎 18th century Arts for everyone
https://artify.launchaco.com
GNU Lesser General Public License v3.0
178 stars 9 forks source link

Bug: Can't Update the wallpaper #63

Open NghiaTranUIT opened 5 years ago

NghiaTranUIT commented 5 years ago

Description

There is a notice that Artify is unable to update a wallpaper if the main screen is not active.

How to reproduce

  1. Get Feature photo
  2. While fetching the photo, we active different window screen.
  3. When it it's finished, there is no update.

Acceptance Criteria

NghiaTranUIT commented 5 years ago

After devoting couple hours to investigate why Artify couldn't override the wallpapers for all spaces, it turns out that https://github.com/NghiaTranUIT/artify-macos/blob/0e4f198b8c1eaff5df92d9b0e831ff5dae1eb795/artify-core/artify-core/Services/WallpaperService.swift#L89-L95 NSScreen.screens only returns the physical screens, not the number of "spaces".

Preliminary effort

From OS < 10.7, macOS stores wallpaper datasource in com.apple.desktop.plist. Otherwise, it stores in ~/Library/Application Support/Dock/desktoppicture.db

This approach is capable of overriding the specific wallpaper for all spaces, but it requires to relaunch the Dock (killall Dock), which I'm super discouraged.

Beside that, editing the desktoppicture.db directly could be potential risk when the database's structure changes. Consequently, it's corrupted.

Thus, I leave this bug here.

References

https://github.com/tech-otaku/macos-desktop https://github.com/SeanHansell/Casper-Change-Desktop