I have this Stream Deck button which has been working fine for ages but now the script is not behaving as it used to and I don't know why.
I can copy the script and run it from Terminal and it works as I expect. The BTT version seems to skip the sed
command. I tried qualifying it with /usr/bin
but it still doesn't work.
[
{
"BTTActionCategory" : 0,
"BTTLastUpdatedAt" : 1733795887.7939949,
"BTTTriggerType" : 730,
"BTTTriggerTypeDescriptionReadOnly" : "Shell Script \/ Task Widget",
"BTTTriggerTypeDescription" : "Battery percentage",
"BTTTriggerClass" : "BTTTriggerTypeStreamDeck",
"BTTUUID" : "28FFEF74-3E9C-4222-AA8C-DF6438289A3F",
"BTTPredefinedActionType" : 366,
"BTTPredefinedActionName" : "Empty Placeholder",
"BTTEnabled" : 1,
"BTTEnabled2" : 1,
"BTTOrder" : 1,
"BTTMergeIntoTouchBarGroups" : 0,
"BTTAdditionalActions" : [
{
"BTTActionCategory" : 0,
"BTTLastUpdatedAt" : 1723852731.1336079,
"BTTTriggerParentUUID" : "28FFEF74-3E9C-4222-AA8C-DF6438289A3F",
"BTTIsPureAction" : true,
"BTTTriggerClass" : "BTTTriggerTypeStreamDeck",
"BTTUUID" : "B1FF2234-29B1-4AEF-A35B-500DB343FF01",
"BTTEnabled" : 1,
"BTTEnabled2" : 1,
"BTTOrder" : 228,
"BTTMergeIntoTouchBarGroups" : 0
}
],
"BTTStreamDeckButtonName" : "Battery percentage",
"BTTTriggerConfig" : {
"BTTScriptRegex" : "(8|9|10)\\d%",
"BTTStreamDeckCornerRadius" : 12,
"BTTStreamDeckDisplayOrder" : 0,
"BTTStreamDeckSFSymbolName" : "battery.75percent",
"BTTStreamDeckAlternateAttributedTitle" : "{\\rtf1\\ansi\\ansicpg1252\\cocoartf2820\n\\cocoatextscaling0\\cocoaplatform0{\\fonttbl\\f0\\fnil\\fcharset0 B612Mono-Regular;}\n{\\colortbl;\\red255\\green255\\blue255;\\red141\\green224\\blue72;}\n{\\*\\expandedcolortbl;;\\cssrgb\\c61176\\c88627\\c35294;}\n\\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\pardirnatural\\qc\\partightenfactor0\n\n\\f0\\fs48 \\cf2 Shell}",
"BTTStreamDeckAlternateIconColor1" : "156.000006, 226.000002, 90.000002, 255.000000",
"BTTStreamDeckAlternateIconColor2" : "156.000006, 226.000002, 90.000002, 255.000000",
"BTTStreamDeckIconColor3" : "255.000000, 192.000004, 114.000001, 255.000000",
"BTTScriptSettings" : {
"BTTShellScriptString" : "pmset -g batt | grep 'InternalBattery' | sed -E -e 's\/.+\\)\\t([0-9]{1,3}%).+\/\\1\/'",
"BTTShellScriptDontTrimWhitepsace" : 0,
"BTTShellScriptConfig" : "\/bin\/zsh:::-c:::-:::",
"BTTShellScriptEnvironmentVars" : ""
},
"BTTStreamDeckAlternateIconColor3" : "156.000006, 226.000002, 90.000002, 255.000000",
"BTTStreamDeckAlternateTextOffsetY" : -16,
"BTTStreamDeckAlternateSFSymbolStyle" : 2,
"BTTStreamDeckImageOffsetY" : 24,
"BTTScriptNeverUpdateTitleBasedOnScriptOutput" : 0,
"BTTStreamDeckIconColor1" : "255.000000, 192.000004, 114.000001, 255.000000",
"BTTStreamDeckMainTab" : 3,
"BTTStreamDeckAlternateCornerRadius" : 12,
"BTTStreamDeckAlternateBackgroundColor" : "0.000000, 0.000000, 0.000000, 255.000000",
"BTTStreamDeckTextOffsetY" : -16,
"BTTStreamDeckAppearanceTab" : 1,
"BTTStreamDeckBackgroundColor" : "0.000000, 0.000000, 0.000000, 255.000000",
"BTTScriptUpdateInterval" : 60,
"BTTStreamDeckUseFixedRowCol" : 0,
"BTTStreamDeckTextOffsetX" : 0,
"BTTStreamDeckAlternateIconType" : 2,
"BTTStreamDeckImageOffsetX" : 0,
"BTTStreamDeckImageHeight" : 24,
"BTTStreamDeckAttributedTitle" : "{\\rtf1\\ansi\\ansicpg1252\\cocoartf2820\n\\cocoatextscaling0\\cocoaplatform0{\\fonttbl\\f0\\fnil\\fcharset0 B612Mono-Regular;}\n{\\colortbl;\\red255\\green255\\blue255;\\red255\\green255\\blue255;}\n{\\*\\expandedcolortbl;;\\csgray\\c100000;}\n\\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\pardirnatural\\qc\\partightenfactor0\n\n\\f0\\fs48 \\cf2 Shell}",
"BTTStreamDeckAlternateImageOffsetX" : 0,
"BTTStreamDeckAlternateImageHeight" : 24,
"BTTStreamDeckIconColor2" : "255.000000, 192.000004, 114.000001, 255.000000",
"BTTStreamDeckIconType" : 2,
"BTTStreamDeckAlternateImageOffsetY" : 24,
"BTTStreamDeckSFSymbolStyle" : 2,
"BTTStreamDeckResizeImage" : 1,
"BTTStreamDeckFixedRow" : {
"BTTStreamDeckFixedCol" : "1",
"BTTStreamDeckFixedRow" : "3"
},
"BTTStreamDeckAlternateSFSymbolName" : "battery.100percent"
}
}
]
From Terminal, it outputs 79%
. From BTT, it outputs -InternalBattery-0 (id=35651683) 79%; AC attached; not charging present: true
.