Skip to content

Instantly share code, notes, and snippets.

@bwmcadams
Last active September 7, 2015 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwmcadams/67ab29ae9082b714b6fa to your computer and use it in GitHub Desktop.
Save bwmcadams/67ab29ae9082b714b6fa to your computer and use it in GitHub Desktop.
Python script to restore the metadata for a Deckset file after it is in version control, via xattr. Set your preferred Theme name and Colorscheme in top of file.
!/usr/bin/env python
#
# Quick Script to Fix the Local Settings of Deckset Themes
#
# Deckset uses `xattr` metadata which isn't preserved
# by version control.
#
# Note that Vim will also overwrite your metadata unless you `set backupcopy=yes`
#
# Brendan McAdams <brendan@boldradius.com>
#
import xattr
import glob
StandardTheme = "next"
StandardColors = "scheme9" # black with white text
print "\n For all Presentations in Filetree, setting Theme '%s' with Color Scheme '%s'..." % (StandardTheme, StandardColors)
for f in glob.glob('*/*.md'):
print "\t *** Fixing '%s'" % f
xattr.setxattr(f, 'com.decksetapp.Theme', StandardTheme)
xattr.setxattr(f, 'com.decksetapp.ColorScheme', StandardColors)
print " Done."
@bwmcadams
Copy link
Author

xattr should ship with OS X's default Python. It was on my freshly installed machine with no extra install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment