Change Stream Deck Profile From Macro

Yea exactly. Not a huge deal but for some reason it just irritated me :sweat_smile:

I think I’ll finally get around to contacting Elgato to see if they have any plans of implementing switching profiles via AppleScript or Shell commands or the like.

1 Like

It's now 2022, will this be the year Elgato finally gets around to adding this? I wonder if there's a way we could upvote this request somewhere.

In the meantime there are some amazingly clever workarounds here as always, love this community!

1 Like

I don't know if they're going to implement it, but your comment made me realize I still hadn't contacted them about it. But I just did and sent them a link to this thread so they can see that there's some enthusiasm for such a feature.

I imagine it would be fairly easy to do, since they already have the framework for it via their Smart Profiles feature. I imagine it would simply be a matter of allowing external access to whatever code switches the profiles.

But I'm not a programmer so what do I really know? :laughing:

I would love this too! I am a windows user though - was anyone successful with recreating the Trigger Apps workaround on Windows 10?

Welcome Daniel.. and a windows user here.. huh.. :slight_smile: Well, the only thing I can think of is 'Autohotkey', I think each instance of a macro runs as it's own program. Might be worth trying out.

Just an FYI:

I did reach out to Elgato to ask them about implementing this in the future, and they replied today.

You can read more info here:
Elgato's Response to Setting Stream Deck Profiles via Keyboard Maestro or Other Third Party Apps

My workaround: combine two images on one streamdeck button, one bigger than the other, which triggers as usual. Use "Device key + modifier" for the alt.
Screen Shot 2022-04-21 at 16.46.28 PM

I don't see how this is an answer to the original question.

I'd somehow missed that @Fokke had written this neat AppleScript solution and merrily went off down my own rabbit hole implementing this in a similar (if messier) way using Bartender menu bar automation. Still, I enjoyed the journey :laughing:. The resultant macro is over here.

So, ignore my previous post - I'm now all in on the @ncbasic/@johns/@noisneil ingenious dummy app method :rofl: And apologies if I'm over-extending this old thread with a slightly different solution to something that's effectively a solved problem.

I've created a subroutine to compile (using osacompile) and run a uniquely-named AppleScript app which stays open for 2s (long enough for the Stream Deck app-based trigger to notice) and then quits itself (so there's no need for the KM macro to quit it).

I found I needed separate apps with unique names/bundle IDs for the Stream Deck to recognise them as distinct per profile, so creating unique apps on the fly seemed easier. They do of course still needed to be manually assigned to each of the Stream Deck profile(s) they need to trigger (I wasn't sure hacking them into the Stream Deck profile's manifest file was wise!).

Trigger a Stream Deck profile

Download the "Trigger a Stream Deck profile" subroutine (14 KB)

Show the macro

The subroutines it calls are all in this other post with the exception of these ones:

Check Stream Deck is installed, running, and hidden

Download the "Check Stream Deck is installed, running, and hidden" subroutine (7.5 KB)

Show the macro

Construct folder path in my iCloud folder (creating required subfolders)

I store some app-specific content in my iCloud folder. This subroutine is used to create any subfolders inside it.

Download the "Construct folder path in my iCloud folder (creating required subfolders)" subroutine (3.8 KB)

Show the macro

Construct folder path in my Apps/application folder

I store most of my KM data (images, dummy apps etc) in subfolders of my iCloud/Apps/Keyboard Maestro/ folder.

Download the "Construct folder path in my Apps-application folder" subroutine (3.5 KB)

Show the macro

2 Likes

With the new Node SDK it's a lot simpler but there's a catch:

As a test I wrote a very simple plugin that opens a Websocket server and then another CLI app that sends messages to that socket.

Then in my KM macros I launch the CLI that sends the WS message with a shell script. I used Rust for the CLI so switching profiles is very fast.

If anyone is interested I can share the solution.

The only caveat is that the SDK doesn't support loading User Profiles yet. The profiles must be bundled with the plugin. Elgato knows the issue so let's hope they'll fix this issue.

Thanks for sharing, but I've seen this method already. As you say, it's cripplingly limited.

Limited? Can you elaborate please? I don't see any limitations besides the SDK limitations that also apply to regular use of the Stream Deck so far.

If I understood correctly, I think the lack of ability to change User profiles through the SDK has been something we've been asking for for YEARS, and it sounds like you still can't.

You can export your existing user profiles & bundle them inside the plugin. Once the plugin prompts you to install them you can edit them again as regular user profiles inside the Stream Deck app.

I'll take this over not having the ability to switch profiles at all.

Perhaps I've misunderstood then.

I'm not sure I understand this part. You bundle the profiles and then you can still edit them? So what's the drawback?

I'm very interested in this. It sounds as though it's quite different to the method I was already aware of. Please do elaborate if you don't mind. It goes without saying that I'd love to try your method if you would care to share it. :pray:t3:

Not to throw water on the proposal, as a matter of fact, I would love to be wrong, but from what I remember, the ability to bundle profiles with your app has always been there. I don't think you can manage those profiles from the StreamDeck UI.

I think this 'node' SDK is just a wrapper on their existing SDK.

That was my presumption too, and I'm hoping it was premature.

It's far from perfect but it works once you've set everything.

Here's how it works. Let's say you want to switch between three profiles that you've already created. You export each one inside the directory of the plugin "com.example.pluginame.sdPlugin"

then you add them at the root level of your plugin's manifest.json:

  "Profiles": [
    {
      "Name": "Profile1",
      "DeviceType": 7
    },
    {
      "Name": "Profile2",
      "DeviceType": 7
    },
    {
      "Name": "Profile3",
      "DeviceType": 7
    }
  ]

You build the plugin and then load it from the Stream Deck app.

In my case the Websocket server starts and is ready to receive messages from my CLI app when the plugin is loaded.

Once the WS server receives any message that triggers the profile switching Stream Deck will prompt you to install the bundled profiles.

Issue 1: You need to delete/remove the original profiles that have the same names otherwise the plugin will create duplicates. e.g. Profile 1 will become Profile 1 copy once it's installed.

Issue 2: If there's any mismatch between the profile names or any of the profiles doesn't exist it gets very buggy and you need to delete the profiles that cause the issues and restart the Stream Deck app and then add again the plugin.

Once the bundled profiles have been installed they act like regular profiles and you can edit them normally as long as you aren't rebuilding the plugin or you remove the plugin both of which will trigger issue 1 again. In that case you need to export the edited profiles and repeat the process once again.

Annoying for sure but workable as a compromise. The next SDK version will add the ability to switch to a specific page of a profile so we won't need as many profiles.

I'll try to share the code in a few days.

1 Like