Change Stream Deck Profile From Macro

@ncbasic's solution is brilliant, and I've got it working well.

One change I've made is to make the "trigger apps" self-terminate. That way you don't need macros to hunt down each one.

on run
    delay 1
    quit
end run
3 Likes

I made this macro using applescript to switch profiles. Still i would like a better solution build in by Elgato but it does work here.

image
Stream Deck Profile Switcher.kmmacros (5.1 KB)

4 Likes

Nice workaround. I tooled around with something similar a few months ago but found it too intrusive for my particular workflow. But I bet some of the folks here could really benefit from your macro. Thanks for sharing!

By 'intrusive' you mean the screen and menu flicker? yes, i agree, that is visually not very elegant. Elgato should help us here....

1 Like

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?