Last active
February 12, 2017 20:44
-
-
Save gregneagle/6225747 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import subprocess | |
import sqlite3 | |
desktop_picture_path = '/Library/Desktop Pictures/Wave.jpg' | |
database_location = os.path.expanduser( | |
'~/Library/Application Support/Dock/desktoppicture.db') | |
conn = sqlite3.connect(database_location) | |
print 'Opened database successfully' | |
conn.execute('DELETE FROM data') | |
conn.execute('INSERT INTO data VALUES (?)', (desktop_picture_path, )) | |
conn.execute('VACUUM data') | |
conn.commit() | |
print 'Records created successfully' | |
conn.close() | |
subprocess.check_call(['/usr/bin/killall', 'Dock']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment