diff options
| author | rob <robert@onepagego.com> | 2019-02-28 18:27:19 -0700 |
|---|---|---|
| committer | rob <robert@onepagego.com> | 2019-03-06 20:39:55 -0700 |
| commit | c41022ff7fad62821f620d3e2ee22ada5e2faa38 (patch) | |
| tree | b3ebfa9cd3c0c68b5832b18cc5a57c562d184b06 | |
| parent | 53740712a6a7693b82fb6f24810716ef54a6831f (diff) | |
Issue #330: MacOS Mojave Dock Crash
| -rw-r--r-- | pywal/wallpaper.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pywal/wallpaper.py b/pywal/wallpaper.py index e648d5a..3ab38af 100644 --- a/pywal/wallpaper.py +++ b/pywal/wallpaper.py @@ -109,7 +109,18 @@ def set_mac_wallpaper(img): """Set the wallpaper on macOS.""" db_file = "Library/Application Support/Dock/desktoppicture.db" db_path = os.path.join(HOME, db_file) - subprocess.call(["sqlite3", db_path, "update data set value = '%s'" % img]) + img_dir, _ = os.path.split(img); + + #Clear the existing picture data and write the image paths + sql = "delete from data; " + sql += "insert into data values(\"%s\"); " % img_dir + sql += "insert into data values(\"%s\"); " % img + + #Set all monitors/workspaces to the selected image + sql += "update preferences set data_id=2 where key=1 or key=2 or key=3; " + sql += "update preferences set data_id=1 where key=10 or key=20 or key=30;" + + subprocess.call(["sqlite3", db_path, sql]) # Kill the dock to fix issues with cached wallpapers. # macOS caches wallpapers and if a wallpaper is set that shares |
