Top Margin doesn't change in Big Sur

Hi
The Top Margin won't change in Big Sur, and now my Beats Status widget looks like this on the menu bar:


As you can see, the top is cut off and I can't fix it how I usually do (by changing the Top Margin).
Not an important bug, but something to add to the list...

Unfortunately I won't be able to make the same values on Catalina look the same on Big Sur (because the font attribute is not supported anymore), but I'll add a new field to adjust the text offset on Big Sur! Should be available in 1-2 days.

2 Likes

epic!

The latest alpha adds an offset option that can be used on Big Sur:

1 Like

awesome. thanks heaps!

It seems to work fine here

Could you post your config?

1 Like

code:

--Original script by Noon Chen, modified by yuuiko to support any bluetooth device and list UI setup.
use framework "IOBluetooth"
use scripting additions

set deviceList to current application's IOBluetoothDevice's pairedDevices()
set devNames to (deviceList's valueForKey:"name") as list
set devStatus to (deviceList's valueForKey:"connected") as list
set devAddress to (deviceList's valueForKey:"addressString") as list

set currentModel to "AirPods" --default widget icon
tell application "BetterTouchTool" to set AirPodsName to get_string_variable "AirPodsWg_DevceName"

if devNames contains AirPodsName then
	repeat with i from 1 to count devNames
		if (item i of devNames) = AirPodsName then
			
			--Get index of AirPods in the list and save connection status and MAC address value
			set connectValue to item i of devStatus
			set MAC_addr to item i of devAddress
			
			------SPECIAL PRODUCT BEHAVIOUR------
			try
				set ProductID to do shell script "/usr/libexec/PlistBuddy -c \"print :DeviceCache:" & MAC_addr & ":ProductID\" /Library/Preferences/com.apple.Bluetooth.plist"
			on error
				set ProductID to "ERROR"
				set currentModel to "Not Airpods"
			end try
			
			--set icons
			if ProductID = "8206" then
				--AirPods Pro
				set currentModel to "AirPods Pro"
				
			else if ProductID = "8207" or ProductID = "8194" then --AirPods 1 & 2, ProductID = 8207/8194
				set currentModel to "AirPods"
				
			else
				set currentModel to "Not Airpods"
			end if
			
			------SPECIAL PRODUCT BEHAVIOUR------
			
			
			------SET TEXT TO RETURN------
			if connectValue = 1 then
				
				try --scan for "BatteryPercentLeft" and "BatteryPercentRight", used in AirPods and probably beats true wireless.
					set BatteryLeft to do shell script "/usr/libexec/PlistBuddy -c \"print :DeviceCache:" & MAC_addr & ":BatteryPercentLeft\" /Library/Preferences/com.apple.Bluetooth.plist"
					set BatteryRight to do shell script "/usr/libexec/PlistBuddy -c \"print :DeviceCache:" & MAC_addr & ":BatteryPercentRight\" /Library/Preferences/com.apple.Bluetooth.plist"
					
					if BatteryLeft = "0" and BatteryRight = "0" then
						return jsonData(currentModel, "Not Connected", 0, 15)
					else
						set batteryText to formatValue(BatteryLeft, "🅛") & "\\n" & formatValue(BatteryRight, "🅡") -- Connected Output
					end if
					
				on error --scan for "BatteryPercent", used in probably apple magic mice, trackpad and keyboards.
					try
						set BatteryLeft to do shell script "/usr/libexec/PlistBuddy -c \"print :DeviceCache:" & MAC_addr & ":BatteryPercent\" /Library/Preferences/com.apple.Bluetooth.plist"
						log BatteryLeft
						
						if BatteryLeft = "0" then
							return jsonData(currentModel, AirPodsName & "\\n" & "Not Connected", 0, 11) --SET OUTPUT probably apple magic mice, trackpad and keyboards not connected
						else
							set batteryText to AirPodsName & "\\n" & "Battery: " & (round BatteryLeft * 100 rounding down) & "%" --SET OUTPUT probably apple magic mice, trackpad and keyboards connected
						end if
						
					on error --scan for "BatteryPercentSingle", used in probably beats.
						try
							set BatteryLeft to do shell script "/usr/libexec/PlistBuddy -c \"print :DeviceCache:" & MAC_addr & ":BatteryPercentSingle\" /Library/Preferences/com.apple.Bluetooth.plist"
							log BatteryLeft
							
							if BatteryLeft = "0" then
								return jsonData(currentModel, AirPodsName & "\\n" & "Not Connected", 0, 11) --SET OUTPUT probably beats not connected
							else
								if BatteryLeft is greater than 1 then
									set batteryText to AirPodsName & "\\n" & "Battery: " & BatteryLeft & "%" --SET OUTPUT probably beats connected
								else
									set batteryText to AirPodsName & "\\n" & "Battery: " & (round BatteryLeft * 100 rounding down) & "%" --SET OUTPUT probably beats connected
								end if
							end if
							
						on error --handle any other generic bluetooth device with no battery report
							log "these aren't airpods"
							
							set currentModel to "Not Airpods"
							set batteryText to AirPodsName & "\\n" & "Connected" --SET OUTPUT generic device connected
						end try
					end try
				end try
				
			else
				return jsonData(currentModel, AirPodsName & "\\n" & "Not Connected", 0, 11) --OUTPUT display device but not connected
			end if
			------SET TEXT TO RETURN------
			
			log "break loop"
			return jsonData(currentModel, batteryText, connectValue, 11) --OUTPUT 
			
		end if
	end repeat
else
	log "widget not setup"
	return jsonData(currentModel, "Bluetooth \\nTap to Setup   ", 0, 11)
end if

--style battery display
on formatValue(batteryLevel, prefix)
	if batteryLevel = "0" then
		return prefix & " --"
	else
		return prefix & batteryLevel & "%"
	end if
end formatValue

--Format into json data to output to BTT
on jsonData(currentModel, batteryText, connectValue, fontSize)
	
	set airpods_iconData to "iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAABxklEQVRoge2ZwUoCURSGfwuiZavW+RBugp4jkraCrxG9RgX5BrVo76Lc1NK1uhe0hYZKTtw4Fw6Dd/TM6IwO/wcHx5lzz/n/Ye5hRBBCCCGEEEJInpwDuAcwADBU0QJwadDhcp9jNVzNO+mxF7wAWACIEqK9gdD2mhoL6VUYJwC+14jUMU4QOjbUcT1PizA9MYj08bWizmeKOpO8zX5I4zcAM6PYqqpTNa6dSU93/J6nYb+nYHwcIxlknpZxrd8WfmaYOcpg2jdfyueVBNT3ioQ+fxE4DuXrur5X0jxIJIthv1bf6dBd1+d/1PHUuNYfHxt0boVfdbdHxseyrgRcG9eOZN1SNOTGqwjoAJgbh04cy9CbS89INOSKdVi5aK4Q2ExRJ/UezsKRvPptKvIxodeDoc4w4+zJzJMMn5BAN6QaGzRpSG6ozlTes/eGG9lfPYkugFoKcTVZ6+t0pPZB4B+9MzERois5B09dXgH9YxnCX3e5t7s0Xdlh7VUGQ/0suZkodNoVAQ2XHRouOzRcdmi47NBw2aHhskPDZWfrhqMo+g/5X1czUNfiub11uXuJF6nE9uXHfT9+zZJLCCGEEEIIIfkC4A9P0HeTJCMKAwAAAABJRU5ErkJggg=="
	set airpods_dark_iconData to "iVBORw0KGgoAAAANSUhEUgAAADwAAAA8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5SVefuejv6pye01P191KnqmdIJBKJRCKRSCTCUMxhHOcCJ4Au4AcwFtN4HoJPAq3ADGC5iv4Qy3gegjc51wVgmV6/jWG8JYaRBhR0EDbHMNYMglHRG4Fua0O5Ci6Xy73OrYjusBbdDDN8DSg59yJ6v5WxZhD8DBiUCXfaVliJthDcBizN2OcOcNubaRF9SF9fwQgteDewBzgAbM3Y9yFwHfjltMnAHQ3pYGjB7fqd8n7vBHZk7P8UeOy1LQzoX3DBg979WmBvhv6Sbm7w2kYC+PWf0IIHgLteAGpX0Y1sbdfkw31uGOgP6aBF0LoH3PQCkIg+XKfPTmCd1/YEuOp9z7QJGgEdHgF/dQ9XBnWxBjQfmdU1XtsDjdrBKRgJrtChS7XWwJa8VVbWFTJg5ZB1tfRR6922GtvHHfCSzqof+IISozz8Aoxq7VtrpmX539B9a0qsengceKnZU6v32R+NxC9iOBIzl/4OTFRpF8GfYzkRa4bnAMf0PMtHlvlq4J0OiikxBM9TsbPrPCOiVwKfdM+bYS14gSYcsybxbFGj+bjlSablHpYAdcQT+959QE88njtNRa24Oq2cshK8BOjxIvJX4EKVZ694J5bi05Yq2VcQLARL3nwQmOm0ybnzaeB3jT4XgdfOfYumpetDO2dRD/d4sUHEntHXTy0ky+rTd3Gl0pIsbFvo49vQgrs9sW9U7GTp18LDpSukg6EFjzrXI7pUs7BIg53Lt5AOhi4P+/TEQvbqUMa+cn61z9v78oo6H9LB0IJl/92fQr9VwC7PnzFdIT8D+md2AJCF+VXESll5tkGgmxLNIPi4F+gkpz5nZcz6xKMap+p89gq4ZGm8GWa4gkT1y9ZGmkXwsJ5QmpPHj2l+sT8USyw5/eVhQosLNKu6lYMPiUQikUgkEonEtAD+AYohf02fXGWtAAAAAElFTkSuQmCC"
	
	if currentModel = "AirPods Pro" then
		if connectValue = 1 then
			set icon to airpods_pro_iconData
		else
			set icon to airpods_pro_dark_iconData
		end if
	else if currentModel = "AirPods" then
		if connectValue = 1 then
			set icon to airpods_iconData
		else
			set icon to airpods_dark_iconData
		end if
	else --if not airpods
		if connectValue = 1 then
			set icon to not_airpods_icon
		else
			set icon to not_airpods_dark_icon
		end if
	end if
	
	return "{\"text\":\"" & batteryText & "\", \"icon_data\": \"" & icon & "\", \"font_size\": \"" & fontSize & "\"}"
end jsonData

What does it look like if you copy this json into your BTT?
Here it looks like this, which seems ok
image

[
  {
    "BTTGestureNotes" : "airpods",
    "BTTTriggerType" : 680,
    "BTTTriggerTypeDescription" : "Menubar Item: airpods",
    "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
    "BTTPredefinedActionType" : -1,
    "BTTPredefinedActionName" : "No Action",
    "BTTEnabled2" : 1,
    "BTTRepeatDelay" : 0,
    "BTTUUID" : "F3E371DC-5079-4452-92D6-AAAACDB1FF5A",
    "BTTNotesInsteadOfDescription" : 0,
    "BTTEnabled" : 1,
    "BTTModifierMode" : 0,
    "BTTOrder" : 8,
    "BTTDisplayOrder" : 0,
    "BTTTriggerConfig" : {
      "BTTScriptType" : 0,
      "BTTTouchBarButtonLineHeight" : 10,
      "BTTTouchBarItemIconWidth" : 22,
      "BTTTouchBarButtonTextAlignment" : 0,
      "BTTTouchBarButtonColor" : "0.000000, 0.000000, 0.000000, 0.000000",
      "BTTTouchBarButtonTopMargin" : 0,
      "BTTTouchBarAlternateBackgroundColor" : "0.000000, 0.000000, 0.000000, 0.000000",
      "BTTTouchBarScriptUpdateInterval" : 1,
      "BTTTouchBarButtonFontSize" : 10,
      "BTTTouchBarAppleScriptString" : "--Original script by Noon Chen, modified by yuuiko to support any bluetooth device and list UI setup.\nuse framework \"IOBluetooth\"\nuse scripting additions\n\nset deviceList to current application's IOBluetoothDevice's pairedDevices()\nset devNames to (deviceList's valueForKey:\"name\") as list\nset devStatus to (deviceList's valueForKey:\"connected\") as list\nset devAddress to (deviceList's valueForKey:\"addressString\") as list\n\nset currentModel to \"AirPods\" --default widget icon\ntell application \"BetterTouchTool\" to set AirPodsName to get_string_variable \"AirPodsWg_DevceName\"\n\nif devNames contains AirPodsName then\n\trepeat with i from 1 to count devNames\n\t\tif (item i of devNames) = AirPodsName then\n\t\t\t\n\t\t\t--Get index of AirPods in the list and save connection status and MAC address value\n\t\t\tset connectValue to item i of devStatus\n\t\t\tset MAC_addr to item i of devAddress\n\t\t\t\n\t\t\t------SPECIAL PRODUCT BEHAVIOUR------\n\t\t\ttry\n\t\t\t\tset ProductID to do shell script \"\/usr\/libexec\/PlistBuddy -c \\\"print :DeviceCache:\" & MAC_addr & \":ProductID\\\" \/Library\/Preferences\/com.apple.Bluetooth.plist\"\n\t\t\ton error\n\t\t\t\tset ProductID to \"ERROR\"\n\t\t\t\tset currentModel to \"Not Airpods\"\n\t\t\tend try\n\t\t\t\n\t\t\t--set icons\n\t\t\tif ProductID = \"8206\" then\n\t\t\t\t--AirPods Pro\n\t\t\t\tset currentModel to \"AirPods Pro\"\n\t\t\t\t\n\t\t\telse if ProductID = \"8207\" or ProductID = \"8194\" then --AirPods 1 & 2, ProductID = 8207\/8194\n\t\t\t\tset currentModel to \"AirPods\"\n\t\t\t\t\n\t\t\telse\n\t\t\t\tset currentModel to \"Not Airpods\"\n\t\t\tend if\n\t\t\t\n\t\t\t------SPECIAL PRODUCT BEHAVIOUR------\n\t\t\t\n\t\t\t\n\t\t\t------SET TEXT TO RETURN------\n\t\t\tif connectValue = 1 then\n\t\t\t\t\n\t\t\t\ttry --scan for \"BatteryPercentLeft\" and \"BatteryPercentRight\", used in AirPods and probably beats true wireless.\n\t\t\t\t\tset BatteryLeft to do shell script \"\/usr\/libexec\/PlistBuddy -c \\\"print :DeviceCache:\" & MAC_addr & \":BatteryPercentLeft\\\" \/Library\/Preferences\/com.apple.Bluetooth.plist\"\n\t\t\t\t\tset BatteryRight to do shell script \"\/usr\/libexec\/PlistBuddy -c \\\"print :DeviceCache:\" & MAC_addr & \":BatteryPercentRight\\\" \/Library\/Preferences\/com.apple.Bluetooth.plist\"\n\t\t\t\t\t\n\t\t\t\t\tif BatteryLeft = \"0\" and BatteryRight = \"0\" then\n\t\t\t\t\t\treturn jsonData(currentModel, \"Not Connected\", 0, 15)\n\t\t\t\t\telse\n\t\t\t\t\t\tset batteryText to formatValue(BatteryLeft, \"🅛\") & \"\\\\n\" & formatValue(BatteryRight, \"🅡\") -- Connected Output\n\t\t\t\t\tend if\n\t\t\t\t\t\n\t\t\t\ton error --scan for \"BatteryPercent\", used in probably apple magic mice, trackpad and keyboards.\n\t\t\t\t\ttry\n\t\t\t\t\t\tset BatteryLeft to do shell script \"\/usr\/libexec\/PlistBuddy -c \\\"print :DeviceCache:\" & MAC_addr & \":BatteryPercent\\\" \/Library\/Preferences\/com.apple.Bluetooth.plist\"\n\t\t\t\t\t\tlog BatteryLeft\n\t\t\t\t\t\t\n\t\t\t\t\t\tif BatteryLeft = \"0\" then\n\t\t\t\t\t\t\treturn jsonData(currentModel, AirPodsName & \"\\\\n\" & \"Not Connected\", 0, 11) --SET OUTPUT probably apple magic mice, trackpad and keyboards not connected\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tset batteryText to AirPodsName & \"\\\\n\" & \"Battery: \" & (round BatteryLeft * 100 rounding down) & \"%\" --SET OUTPUT probably apple magic mice, trackpad and keyboards connected\n\t\t\t\t\t\tend if\n\t\t\t\t\t\t\n\t\t\t\t\ton error --scan for \"BatteryPercentSingle\", used in probably beats.\n\t\t\t\t\t\ttry\n\t\t\t\t\t\t\tset BatteryLeft to do shell script \"\/usr\/libexec\/PlistBuddy -c \\\"print :DeviceCache:\" & MAC_addr & \":BatteryPercentSingle\\\" \/Library\/Preferences\/com.apple.Bluetooth.plist\"\n\t\t\t\t\t\t\tlog BatteryLeft\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif BatteryLeft = \"0\" then\n\t\t\t\t\t\t\t\treturn jsonData(currentModel, AirPodsName & \"\\\\n\" & \"Not Connected\", 0, 11) --SET OUTPUT probably beats not connected\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif BatteryLeft is greater than 1 then\n\t\t\t\t\t\t\t\t\tset batteryText to AirPodsName & \"\\\\n\" & \"Battery: \" & BatteryLeft & \"%\" --SET OUTPUT probably beats connected\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tset batteryText to AirPodsName & \"\\\\n\" & \"Battery: \" & (round BatteryLeft * 100 rounding down) & \"%\" --SET OUTPUT probably beats connected\n\t\t\t\t\t\t\t\tend if\n\t\t\t\t\t\t\tend if\n\t\t\t\t\t\t\t\n\t\t\t\t\t\ton error --handle any other generic bluetooth device with no battery report\n\t\t\t\t\t\t\tlog \"these aren't airpods\"\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tset currentModel to \"Not Airpods\"\n\t\t\t\t\t\t\tset batteryText to AirPodsName & \"\\\\n\" & \"Connected\" --SET OUTPUT generic device connected\n\t\t\t\t\t\tend try\n\t\t\t\t\tend try\n\t\t\t\tend try\n\t\t\t\t\n\t\t\telse\n\t\t\t\treturn jsonData(currentModel, AirPodsName & \"\\\\n\" & \"Not Connected\", 0, 11) --OUTPUT display device but not connected\n\t\t\tend if\n\t\t\t------SET TEXT TO RETURN------\n\t\t\t\n\t\t\tlog \"break loop\"\n\t\t\treturn jsonData(currentModel, batteryText, connectValue, 11) --OUTPUT \n\t\t\t\n\t\tend if\n\tend repeat\nelse\n\tlog \"widget not setup\"\n\treturn jsonData(currentModel, \"Bluetooth \\\\nTap to Setup   \", 0, 11)\nend if\n\n--style battery display\non formatValue(batteryLevel, prefix)\n\tif batteryLevel = \"0\" then\n\t\treturn prefix & \" --\"\n\telse\n\t\treturn prefix & batteryLevel & \"%\"\n\tend if\nend formatValue\n\n--Format into json data to output to BTT\non jsonData(currentModel, batteryText, connectValue, fontSize)\n\t\n\tset airpods_iconData to \"iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6\/NlyAAABxklEQVRoge2ZwUoCURSGfwuiZavW+RBugp4jkraCrxG9RgX5BrVo76Lc1NK1uhe0hYZKTtw4Fw6Dd\/TM6IwO\/wcHx5l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ZB1tfRR6922GtvHHfCSzqof+IISozz8Aoxq7VtrpmX539B9a0qsengceKnZU6v32R+NxC9iOBIzl\/4OTFRpF8GfYzkRa4bnAMf0PMtHlvlq4J0OiikxBM9TsbPrPCOiVwKfdM+bYS14gSYcsybxbFGj+bjlSablHpYAdcQT+959QE88njtNRa24Oq2cshK8BOjxIvJX4EKVZ694J5bi05Yq2VcQLARL3nwQmOm0ybnzaeB3jT4XgdfOfYumpetDO2dRD\/d4sUHEntHXTy0ky+rTd3Gl0pIsbFvo49vQgrs9sW9U7GTp18LDpSukg6EFjzrXI7pUs7BIg53Lt5AOhi4P+\/TEQvbqUMa+cn61z9v78oo6H9LB0IJl\/92fQr9VwC7PnzFdIT8D+md2AJCF+VXESll5tkGgmxLNIPi4F+gkpz5nZcz6xKMap+p89gq4ZGm8GWa4gkT1y9ZGmkXwsJ5QmpPHj2l+sT8USyw5\/eVhQosLNKu6lYMPiUQikUgkEonEtAD+AYohf02fXGWtAAAAAElFTkSuQmCC\"\n\t\n\tif currentModel = \"AirPods Pro\" then\n\t\tif connectValue = 1 then\n\t\t\tset icon to airpods_pro_iconData\n\t\telse\n\t\t\tset icon to airpods_pro_dark_iconData\n\t\tend if\n\telse if currentModel = \"AirPods\" then\n\t\tif connectValue = 1 then\n\t\t\tset icon to airpods_iconData\n\t\telse\n\t\t\tset icon to airpods_dark_iconData\n\t\tend if\n\telse --if not airpods\n\t\tif connectValue = 1 then\n\t\t\tset icon to not_airpods_icon\n\t\telse\n\t\t\tset icon to not_airpods_dark_icon\n\t\tend if\n\tend if\n\t\n\treturn \"{\\\"text\\\":\\\"\" & batteryText & \"\\\", \\\"icon_data\\\": \\\"\" & icon & \"\\\", \\\"font_size\\\": \\\"\" & fontSize & \"\\\"}\"\nend jsonData",
      "BTTTouchBarAppleScriptStringRunOnInit" : false,
      "BTTTouchBarAppleScriptUsePath" : 0,
      "BTTTouchBarOnlyShowIcon" : false,
      "BTTTouchBarItemIconHeight" : 22,
      "BTTTouchBarButtonBaselineOffset" : -5
    }
  }
]

looks good :slight_smile:

oops, doesn't matter. when the font is white, it looks good. when the font is my custom colour (FF605E) then it stops working.

Ahh, thanks I can reproduce that! Will fix :slight_smile:

1 Like

when will an update with the fix be out, approximately?

1 hour

1 Like

just tested, looks good as new :slight_smile: ty!

1 Like
Imprint | Privacy Policy