Keyboard Maestro macro to automatically backup Stream Deck profiles

Apologies for the crosspost, but I don’t know how many of you are on the Keyboard Maestro forum, but I do know that there are several people including @MacSparky and @ismh (and I think @RosemaryOrchard too) who use a Stream Deck.

One of my biggest grievances with the Stream Deck is that there’s no way to automatically back up your profiles. Since these profiles can represent a lot of time customizing them, they would be a PITA to lose and have to re-create.

Turns out that these profiles are stored in:

~/Library/Application Support/com.elgato.StreamDeck/ProfilesV2/

which each sub-folder representing a different profile. I did some testing and it appears that you can restore these if you accidentally delete or muck-up one of your profiles.

So I wrote a script that will create a backup of that folder, and I created a Keyboard Maestro macro to run that script every time that you quit the Stream Deck app.

You can find the macro here:

It is also on GitHub:

If you do not use Keyboard Maestro, you can use the script (available separate at the GitHub link) with something like launchd to backup every night at midnight, for example.

One flaw in the script is that it does not check for duplicates, so if it runs and the profiles have not changed since the last backup, you’ll end up with a duplicate backup. However, these backups are pretty small, so they won’t use a lot of disk space. Nevertheless, I’ll probably get annoyed and fix this in a future version.

Oh, and the backup file is saved by default to ~/Dropbox/ but you can change that by editing one line of the script, and I’ve labeled it and put it at the top of the macro so you can find it easily. If you’re not sure how to do that, please let me know.

4 Likes

Been meaning to set this up. Thanks for sharing!

Not to rain on your parade, but aren’t these backed up in regular backups?

Short Answer: Yes.

My Mac is currently backed up to:

  • Time Capsule (hourly, via Arq)
  • Time Machine
  • Backblaze (daily)
  • Carbon Copy Cloner (hourly)

Q: Why have another backup of this particular set of data?

A: There is significant hassle involved with having to set this up again if something goes poorly or if I make some change and realize that I mucked it all up. The backups themselves are mostly insignificant in size. So… my feeling is “Why not?”

Version 1 is not the final Version

As I anticipated, once I started thinking about this, I found a different / better way of doing it, which:

  1. Backs up the profiles immediately, whenever there is a change
  2. Only backs up when a change has been made, regardless of how many times the backup script is run.
  3. Doesn’t require Keyboard Maestro at all (uses launchd)

This new version gives me something approximating “undo” functionality.

This also seems to “fit” better with how I actually create/modify Stream Deck profiles:

  1. Lots of changes over a short period of time
  2. Long periods of time with no changes.

With the new version, when I get into one of those “lots of changes in a short amount of time” moods, I can do so knowing that if I end up realizing “This was all terrible, I should go back to when I started” I can do that, but I can also work for 10 minutes and think, “I was going pretty well until about 5 minutes when I started changing X. I’m going to go back to that version."

Those sorts of “bursts” of changes are very unlikely to be captured by any sort of daily or hourly backup plan. At best, they might let me say “Well, none of this is good, I want to go back to how it was yesterday/ last night/etc.”

That’s why, at least for me, it’s worth it.

4 Likes

Yeah, that makes sense. Thanks for taking the time to explain.

1 Like

Is it possible to add these to version control? I export my KM macros at least once a week and store them in a GIT repo.

I’m thinking of adding my StreamDeck profiles.

Thoughts?
- Mark

…last question is the version you have in Github that I just cloned v1 or v1.1?

I believe Stream Deck profiles are just XML files.

As for the version, it’s probably 1.1 but if you found a reference to 1.0 it’s because I’m not good at GitHub
:slight_smile:

On my system it’s a mix of JSON files and PNG files (for custom images).

I might have looked at the wrong place in the past, because I did only saw binary files then.

So thank you for mentioning this folder!

I may have been thinking JSON when I said XML. Same idea, at least in my head.

In the end I cobbled together a script with hardcoded paths for now. (Ugh)


cd “/Users/marklevison/Documents/GitHub/MacOSAutomation/StreamdeckProfile”
defaults export com.elgato.StreamDeck StreamDeckPlistBackup
plutil -convert xml1 StreamDeckPlistBackup
cp -R “/Users/marklevison/Library/Application Support/com.elgato.StreamDeck” /Users/marklevison/Documents/GitHub/MacOSAutomation/StreamdeckProfile