Touchbar Widget disappears when Applescript JSON return value contains emptystring for text

Describe the bug
Similar to this issue: Bugs when Returning JSON Object from Applescript

My JSON return value from the Applescript for my widget looks like this:
"{\"text\": \"\", \"icon_path\": \"/Users/.../fa-plus.icns\", \"background_color\": \"50,50,50,255\"}"

When the text value is set to an empty string, like above, the widget does not appear. This is a problem because I can't seem to create a widget that has no text but simply an icon that swaps based on the return value of the script. If I set the text value to a space (e.g. "{\"text\": \" \"}") the widget expands in width, so this is not a viable solution.

Device information
MacBook Pro 2016 15" w/ Touch Bar running 10.13.6, BTT v. 2.636 (945)

This is a feature IMO. If you want to display nothing, you can return a zero-width space character:

1 Like

If this was a feature, then it should check against an icon_path in the return JSON. If text is an empty string and the icon_path is not present, then it should not display. But if an icon_path is there then it should, with no text.

I tried the zero-width space character and it still extends the width of the widget, unfortunately.

you just need to check "only show icon" in the widget settings. Then it will not show the text.

Excellent -- I should have tried that -- thank you Andreas! You can close this.