neither 'icon_path' nor 'icon_data' work when returning a JSON for menu bar script icon trigger

Hi @Andreas_Hegenberg , hoping you can help with this one please!

Describe the bug

I'm returning a JSON from a Shell Script Menu Bar Icon, and can't seem to get either the icon_path or icon_data fields to actually show the specified icon. I've tried either specifying an absolute path to the file or generating the base64 data myself via base64 -i /path/to/input.png | pbcopy, but neither works.

If I supply an sf_symbol_name instead, it is rendered correctly. Or if I set the file directly via BTT's ui rather than returning it as part of the JSON, it also works.

All the other parameters ('font_size', 'background_color' etc) show correctly. I've also tried with an Applescript menu bar item, but the result is the same.

I know that BTT is at least recognising the fact that I've supplied either icon_data or an icon_path, as the spacing before the item's text increases very slightly, but it just won't render the image. I've also tried to resize my .png file to a variety of other dimensions, but nothing seems to make any difference. Am I just overlooking something obvious?


Device information:

  • Type of Mac: MacBook Air M1
  • macOS version: 12.5.1
  • BetterTouchTool version: 4.175 (2392)

Additional information (e.g. crash logs, related issues, etc.):

Simplest reproducible example:

[
  {
    "BTTLastUpdatedAt" : 1689946327.4032691,
    "BTTTriggerType" : 681,
    "BTTTriggerTypeDescription" : "Menubar Item: menubar test",
    "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
    "BTTPredefinedActionType" : 206,
    "BTTPredefinedActionName" : "Execute Shell Script \/ Task",
    "BTTGenericActionConfig" : "open -b 'com.apple.systempreferences' '\/System\/Library\/PreferencePanes\/Network.prefPane'",
    "BTTGenericActionConfig2" : "\/bin\/zsh:::-c:::-:::",
    "BTTShellTaskActionScript" : "open -b 'com.apple.systempreferences' '\/System\/Library\/PreferencePanes\/Network.prefPane'",
    "BTTShellTaskActionConfig" : "\/bin\/zsh:::-c:::-:::",
    "BTTAdditionalConfiguration" : "\/bin\/zsh:::-c:::-:::",
    "BTTUUID" : "E05D33F5-7CBB-4F3F-BF4C-AD3CA934F1AB",
    "BTTEnabled" : 1,
    "BTTEnabled2" : 1,
    "BTTGestureNotes" : "menubar test",
    "BTTTriggerConfig" : {
      "BTTTouchBarButtonColor" : null,
      "BTTTouchBarAppleScriptStringRunOnInit" : true,
      "BTTTouchBarItemSFSymbolWeight" : 0,
      "BTTTouchBarFontColorAlternate" : null,
      "BTTTouchBarButtonMonoSpace" : 0,
      "BTTTouchBarScriptUpdateInterval" : 1,
      "BTTTouchBarButtonBaselineOffset" : 0,
      "BTTTouchBarButtonLineHeight" : 0,
      "BTTTouchBarItemSFSymbolDefaultIcon" : "",
      "BTTTouchBarItemIconHeight" : 22,
      "BTTTouchBarButtonTextAlignment" : 0,
      "BTTTouchBarAlternateBackgroundColor" : "0.000000, 0.000000, 0.000000, 0.000000",
      "BTTTouchBarAppleScriptUsePath" : 0,
      "BTTTouchBarItemIconType" : 1,
      "BTTTouchBarItemIconWidth" : 22,
      "BTTTouchBarButtonTopMargin" : 0,
      "BTTTouchBarShellScriptString" : "printf -- \"{\n  'icon_data': 'iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAJZlWElmTU0AKgAAAAgABQEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAAExAAIAAAARAAAAWodpAAQAAAABAAAAbAAAAAAAAAgAAAAAAQAACAAAAAABd3d3Lmlua3NjYXBlLm9yZwAAAAOgAQADAAAAAQABAACgAgAEAAAAAQAAADCgAwAEAAAAAQAAADAAAAAAODg7VQAAAAlwSFlzAAE69gABOvYBOrFXOgAAAWRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDYuMC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3h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G7rgVdsbZfY5hk4fVRVv4qMQkjjC85hueHSNa8M+7unePSJebPthD1TSs67dW9or9quA6bhU4jy+a\/u9sQSDupKRl9Y1eFP6v88O3ry7oQVCa4RRnXPhduaxb4m3tZdSCDg2+pMgdrP3akb+AIsFndZv6dVII85tjeTplA46\/O\/J02fbyJPkMIRg0+Mh5rp12rCux8ST7SCkgz+ArlqnXlWS25dIwrO+X8pWom7ol5EXQRcVKCpQVKCoQFGBogI5KvAHqyASHX+rFrYAAAAASUVORK5CYII=',\n  'text': 'foobar',\n  'background_color': '255,55,100,100',\n}\"\n",
      "BTTTouchBarButtonFontSize" : 10,
      "BTTTouchBarFontColor" : null,
      "BTTTouchBarOnlyShowIcon" : false
    }
  }
]