TODO: figure out how yabai
gets the space / display uuids and document that here.
The database contains 6 tables:
data
which maps to avalue
displays
which maps to a varchar `display_uuidpictures
which maps to an integerspace_id
and integerdisplay_uuid
preferences
which maps to an integerkey
, integerdata_id
, and integerpicture_id
prefs
which maps to an integerkey
anddata
spaces
which maps to aspace_uuid
It also contains an index for each table:
data
usesvalue
asdata_index
displays
usesdisplay_uuid
asdisplays_index
pictures
usespictures_uuid
aspictures_index
preferences
usespicture_id
anddata_id
aspreferences_index
prefs
useskey
asprefs_index
spaces
usesspaces_uuid
asspaces_index
Lastly it contains some triggers for deletion to help cleanup data strewn across other tables (for instance, when a spaces
entry is deleted, the relevant rows in pictures
is removed as well). The names are derived from the table name by adding _deleted
to the singular form (with the exception being preferences_deleted
for preferences
).
The displays
table contains a list of the UUIDs for each display that has had the wallpaper configured for at least one if it's spaces. A list of the currently connected displays (including the UUIDs) can be retrieved using the CGGetActiveDisplayList
function found in the Carbon
headers.
Like the displays
table, the spaces
table contains a list of the UUIDs of each space, regardless of display, that has had it's wallpaper configured. Using the internal SkyLight function SLSCopyManagedDisplaySpaces
, a Display's UUID can be used to find the list of spaces associated with the display, and SLSSpaceCopyName
can retrieve the space's UUID.
Oddly enough, I have only seen this table empty. Granted, I do not use desktop image cycling, which may be for what it is, but as for as I have seen it does not have a use.
Generaly dumping place for data that is used in the preferences table. This consists of file and folder paths, unsigned integers, and decimals.
// TODO
Each picture entry will have keys and values associated with it. The following keys are valid:
- '1': index into the
data
table that denotes the picture's wallpaper file. - '10': index into the
data
table that denotes the picture's wallpaper's folder. - '20': index into the
data
table that, at least so far, is '0'. Those three are always present, even if the background is just a solid color (in that case the folder is/System/Library/Desktop Pictures/Solid Colors
and the file is/System/Library/PreferencePanes/DesktopScreenEffectsPref.prefPane/Contents/Resources/DesktopPictures.prefPane/Contents/Resources/Transparent.tiff
; I know, a mouthful). - '15': when present, indicates a background color should be drawn. The value it points to is always '3' regardless of index (maybe to interpret the colorspace?)
- '3', '4', '5': indices into the
data
tables to denote R, G, and B (respectively) for the background color
No doubt since cycling and different fit method exist, there are more. But those that are currently used by macpaperd
are those above.