elgatosf / streamdeck-plugin-template

A starting place for a new JavaScript Stream Deck plugin.
MIT License
180 stars 69 forks source link

set title not working #7

Closed JarekSour closed 1 year ago

JarekSour commented 1 year ago

hey, i'm on my first plugin, and i need set a new title

i try with these options but none work

myAction.onKeyDown(({ action, context, device, event, payload }) => { 
   $SD.send(context, Events.setTitle, { title: "testing title" }); 
   $SD.setTitle(context, "testing title");
   ...
ChekTek commented 1 year ago

Hi!

Do you have a title set from the property inspector? A title set by the user in the Property Inspector will override one set by the API. We recently introduced a UserTitleEnabled flag at the action level in the manifest.json to disable the property inspector in case the action needs to display data there.

https://docs.elgato.com/sdk/plugins/manifest#actions

You may also want to log a message or use $SD.showOk(context); to verify that your keyDown event is coming through. If it's not you'll want to double check that the action UUID in the manifest matches the identifier passed into the action's constructor.

theca11 commented 1 year ago

I've just come across this issue too. I think the documentation needs to clearly reflect that the title can't be dynamically changed if the user sets a custom one in the property inspector. For images, this is pointed out in some changelog entry : Custom user images are always used even if a plugin dynamically renders an image. For titles there isn't any indication and, in fact, the event payload description includes this: The title to display. If there is no title parameter, the title is reset to the title set by the user. This points to API-set and user-set titles being able to co-exist, because if you can reset the title to the one set by the user it implies that you could previously set it to something different, which doesn't seem to be the case if I understand correctly.