Hello!
I used to show an HUD from a script using following code (Node.js):
let BTT = {
async action(actionType, actionName, opts={}) {
let url = `http://127.0.0.1:${BTT_PORT}/trigger_action/?json=` +
encodeURIComponent(JSON.stringify({
"BTTPredefinedActionType" : actionType,
"BTTPredefinedActionName" : actionName,
...opts,
}))
+ "&shared_secret=" + encodeURIComponent(BTT_SHARED_SECRET);
await exec(`curl "${url}"`);
},
async showHUD(title, detail) {
await this.action(254, "Zeige HUD Overlay", {
BTTHUDActionConfiguration: JSON.stringify({
BTTActionHUDTitle: title,
BTTActionHUDDetail: detail,
BTTActionHUDDuration: 0.9,
BTTActionHUDBackground: "96, 96, 96, 255",
BTTActionHUDSlideDirection: 0
}),
});
},
}
If I remember correctly, the text color used to be white, however, now it is black. Anyways, I discovered, that you can use fully formatted text using BTTActionHUDAttributedTitle
. It seems to be some com.apple.flat-rtfd pasteboard format, but how do I create that outside of a Cocoa environment? This is an example that I copied from text created in BTT itself.
`rtfd\x00\x00\x00\x00\x03\x00\x00\x00\x02\x00\x00\x00\x07\x00\x00\x00TXT.rtf\x01\x00\x00\x00.[\x02\x00\x00+\x00\x00\x00\x01\x00\x00\x00S\x02\x00\x00{\\rtf1\\ansi\\ansicpg1252\\cocoartf2709
\\cocoatextscaling0\\cocoaplatform0{\\fonttbl\\f0\\fnil\\fcharset0 SFPro-Bold;\\f1\\fswiss\\fcharset0 Helvetica;\\f2\\fnil\\fcharset0 SFPro-Regular;
}
{\\colortbl;\\red255\\green255\\blue255;\\red192\\green13\\blue33;}
{\\*\\expandedcolortbl;;\\cssrgb\\c80784\\c13725\\c16863;}
\\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\pardirnatural\\qc\\partightenfactor0
\\f0\\b\\fs80 \\cf2 test
\\f1\\b0\\fs24 \\
\\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\pardirnatural\\qc\\partightenfactor0
\\f2\\fs48 \\cf2 test2}\x01\x00\x00\x00#\x00\x00\x00\x01\x00\x00\x00\x07\x00\x00\x00TXT.rtf\x10\x00\x00\x00Ù\x93hd¶\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00`
PS: I forgot to mention, that BTTActionHUDAttributedTitle
contains a base64-encoded string, the above example is obviously already decoded.