Wallpaper Mavericks…

I have finally had enough of Mavericks’ shenanigans when it comes to Desktop Wallpapers…

For those not in the know, in OS X Mavericks, Apple has changed the mechanism for configuring Desktop Wallpaper from the venerable .plist to using a Sqlite3 database.

While using the database is probably more robust and easier to integrate, it is not as easy to change the desktop or, even more important from my perspective, to change all your desktops to the same wallpaper.

After some Googling and digging, I finally came up with the following little Python script which I called, reasonably enough, changewall:

#!/usr/bin/python

from __future__ import print_function

import os, sys, subprocess
import sqlite3

if len( sys.argv ) < 2:
    sys.exit( 'Usage: "%s" file-name' % sys.argv[ 0 ] )

if not os.path.exists( sys.argv[1] ):
    sys.exit( 'ERROR: File "%s" was not found!' % sys.argv[ 1 ] )

desktop_picture_path = sys.argv[ 1 ]
database_location = os.path.expanduser( '~/Library/Application Support/Dock/desktoppicture.db' )

conn = sqlite3.connect( database_location )
print( 'Opened database', end=", " )

cur = conn.cursor()
cur.execute( 'SELECT count( DISTINCT display_id ) + 1 FROM pictures;' )
displays = cur.fetchone()[0]

cur.execute( 'SELECT count( DISTINCT space_id ) + 1 FROM pictures;' )
spaces = cur.fetchone()[0]

conn.execute( 'DELETE FROM preferences' )

conn.execute( 'DELETE FROM data' )
conn.execute( 'INSERT INTO data VALUES (?)', ( desktop_picture_path, ))
conn.execute( 'VACUUM data' )

screens = spaces * displays
for screen in range( screens ):
    conn.execute( 'INSERT INTO preferences VALUES (1,1,?)', ( screen + 1, ))
    conn.execute( 'VACUUM preferences' )

conn.commit()

print( 'Records created successfully', end=", " )
conn.close()
print( 'Closed database' )

subprocess.check_call( ['/usr/bin/killall', 'Dock'] )

Not all that impressive, I’m fully aware, but it does seem to do the job. Using it is simplicity itself: changewall ~/Wallpaper/funky_wallpaper.jpg

As usual, do with it what you will…

Okay… Colour me impressed by Apple!

From TUAW via Cult of Mac comes the following:

Apple is offering free repairs to those with Macs and iOS devices who had their equipment damaged in the earthquake and tsunami that struck Japan back in March.

A guide[Link content now changed] on Apple’s Japanese website states the company is offering free repairs to Macs, Cinema Displays, iPhones, iPads, and iPod touches for people who live in the municipalities covered be the Disaster Relief Act of 2011.

For those affected, Apple will pick up and repair your equipment at no charge, then deliver it back to you once the repairs are complete. The company is also offering free access to the AppleCare Service & Support Line for those who can solve issues over the telephone.
Apple has been keen to help those in Japan who have been affected by the recent disasters: It has opened up its stores as ‘communication centers’ and allowed people to access the Internet to contact their loved ones through email, FaceTime and Skype. It has also offered donations from app proceeds and allowed customers to donate to the Red Cross through iTunes.

Maybe some lessons to be taken here by the rest of Tech…