diff options
| author | Aaron Eikenberry <aeikenberry@gmail.com> | 2017-08-02 23:41:51 -0500 |
|---|---|---|
| committer | Aaron Eikenberry <aeikenberry@gmail.com> | 2017-08-02 23:41:51 -0500 |
| commit | 282605376dc017cfe8a7d562e4a7e3f78bcb63f1 (patch) | |
| tree | f7e7c1c28d826477814312bcfac1bd5ecafc53e7 /pywal/wallpaper.py | |
| parent | 648ff3c4f0480a5ef528cd3118e9bc4fee393e7e (diff) | |
reverts unsafe shell=True, add option for skipping reload environment
Diffstat (limited to 'pywal/wallpaper.py')
| -rw-r--r-- | pywal/wallpaper.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pywal/wallpaper.py b/pywal/wallpaper.py index 17c60a1..f1ce1dd 100644 --- a/pywal/wallpaper.py +++ b/pywal/wallpaper.py @@ -83,7 +83,14 @@ def set_desktop_wallpaper(desktop, img): def set_mac_wallpaper(img): """Set the wallpaper on macOS.""" - subprocess.Popen(f"""osascript -e 'tell application "Finder" to set desktop picture to POSIX file "{img}"'""", shell=True) + db_file = HOME / "Library/Application Support/Dock/desktoppicture.db" + subprocess.call(["sqlite3", db_file, f"update data set value = '{img}'"]) + + # Kill the dock to fix issues with cached wallpapers. + # macOS caches wallpapers and if a wallpaper is set that shares + # the filename with a cached wallpaper, the cached wallpaper is + # used instead. + subprocess.call(["killall", "Dock"]) def change(img): |
