Colorful Playback Widget(Updated)

which one??

It seems that turning off "Always show when widget becomes visible" makes the widgets stay on the touchbar, but they still aren't coloured. and then when I change the song, the widgets disappear again.

So weird, I can't imagine what could be going wrong because the Spotify version seemed to be working well. In your Application Support/BetterTouchTool/ folder you should have two images called "cover.jpg" and "icover.jpg". I think it's a problem with the sips command, I'll update the download links now.

Got it, sips command is fine, no need to change anything or download a new version.

This is a little complicated but I'm %95 sure it will solve your problem.

Open a terminal and type in the command: where python3

This will return one or many paths

Next, for each path(trial and error) run the command PATH -m pip install Pillow in terminal, replacing the PATH with the output of the first command.

This is trying to find the right python version to install a needed package on, and there's no better way to get it right than to just try every version. It's also likely that you only have one version, and the command returns one path.

After running the command it will probably load for about a minute, and then return something like: Successfully installed pillow, python3.9

After this, the widgets will start working.

1 Like
samhumphreys@MacBook-Pro-2 ~ % /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -m install Pillow
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3: No module named install

this happened with every path

I think you're forgetting the "pip" in the command, after -m

Theres also a chance that you don't have pip installed, in that case you can go to https://pip.pypa.io/en/stable/installing/# to install it. It's just a package manager, and the python script uses a package called "Pillow", which the former command is trying to install.

yep, I forgot to do the pip command. it worked, but it said that a new version of pip is available. should I download it? or will it be fine?
the widgets are still not working, only showing this:

I think it would be a good idea to start from the start, and you tell me exactly what I need to do? just because there was a lot of confusion, and now I feel like I missed a step somewhere. if you're okay with that?

Would love to. I'm glad you're willing to keep trying to get it working, however it's getting late where I live so I'm going to start working on it tomorrow. I'll clean up the code and hopefully make a version that requires no setup. Hope it works!

awesome! I'm glad youre willing to keep helping. have a good night.

I uninstalled and reinstalled everything to get a clean slate, and to figure out why it was working on my Mac and not yours. I can't believe this but the error was upgrading pip, I never upgrade it lol.
You should be able to run this code in terminal and it will start working.
/usr/bin/python3 -m pip --upgrade pip
and then
/usr/bin/python3 -m pip install Pillow

The next and previous buttons will likely not show and you'll have to go in and manually refresh them.

If this doesn't work, then I'm really going to start over.

Hope this is our last debugging! :slight_smile:

You may also need to install Macos command line developer tools, I got prompted to install it but I'm hoping it won't be necessary.

idk how to do that

Upgrading pip didn't work?

oh I didn't see that. give me a bit.

I upgraded pip, then installed Pillow. That all worked fine. The colours still aren't working, but I haven't done this:

how do I do that?

I think if you type make into terminal and press enter it's supposed to prompt you to install command line developer tools. I'm not sure if that works, because I already have them installed. If it doesn't then you can open "Script Editor" and paste in try tell application "BetterTouchTool" set sName to get_string_variable "BTTNowPlayingInfoTitle" end tell set p to (POSIX path of ((path to application support folder from user domain) as text)) do shell script "set -- $(ls -lt ~/Library/Containers/com.apple.AMPArtworkAgent/Data/Documents/artwork/);cp ~/Library/Containers/com.apple.AMPArtworkAgent/Data/Documents/artwork/${11} ~/Library/Application\\ Support/BetterTouchTool/icover.jpg" do shell script "sips -Z 30 -o ~/Library/Application\\ Support/BetterTouchTool/cover.jpg ~/Library/Application\\ Support/BetterTouchTool/icover.jpg" set iColors to do shell script "python3 -c \"from PIL import Image og=[];vs=[];tmp=[];tmpi=[] img=Image.open('" & p & "BetterTouchTool/cover.jpg', 'r').convert('RGB').getcolors(maxcolors=99999) for i in img: for u in range(i[0]): og.append(i[1]) vs.append(i[1]) dict = {} count, itm = 0, '' for item in reversed(og): dict[item] = dict.get(item, 0) + 1 if dict[item] >= count : count, itm = dict[item], item ur=itm for i in og: if abs(i[0]-ur[0]) < 100: if abs(i[1]-ur[1]) < 100: if abs(i[2]-ur[2]) < 100: vs.remove(i) if len(vs)!=0: for i in vs: tmp.append((round(i[0]/2,-1)*2,round(i[1]/2,-1)*2,round(i[2]/2,-1)*2)) dict = {} count, itm = 0, '' for item in reversed(tmp): dict[item] = dict.get(item, 0) + 1 if dict[item] >= count : count, itm = dict[item], item a=itm for i in range(len(tmp)): if tmp[i]==a: tmpi.append(i) for i in reversed(range(len(vs))): if i not in tmpi: vs.remove(vs[i]) vs=[[vs[j][i] for j in range(len(vs))] for i in range(len(vs[0]))] l=len(vs[0]) a=(sum(vs[0])/l,sum(vs[1])/l,sum(vs[2])/l) else: a=(75,75,75) print(str(ur[0])+','+str(ur[1])+','+str(ur[2])) print(str(round(a[0]))+','+str(round(a[1]))+','+str(round(a[2]))) \"" set f to alias (((path to application support folder from user domain) as text) & "BetterTouchTool:color.txt") set a to open for access f with write permission set eof of a to 0 write "{\"font_color\":\"" & (paragraph 2 of iColors) & ",255\",\"background_color\":\"" & (paragraph 1 of iColors) & ",255\"}" to a close access a do shell script "rm ~/Library/Containers/com.apple.AMPArtworkAgent/Data/Documents/artwork/*" return "{\"text\":\"" & sName & "\",\"font_color\":\"" & (paragraph 2 of iColors) & ",255\",\"icon_path\":\"" & p & "BetterTouchTool/icover.jpg\",\"background_color\":\"" & (paragraph 1 of iColors) & ",255\"}" on error return "{\"text\":\"" & sName & "\",\"font_color\":\"" & (paragraph 2 of iColors) & ",255\",\"icon_path\":\"" & p & "BetterTouchTool/icover.jpg\",\"background_color\":\"" & (paragraph 1 of iColors) & ",255\"}" end try
and hit the play button, this is how I did it and it will prompt you to install. It takes about 10 mins.

when I pressed play this happened

Try the same thing with this, my bad:
tell application "BetterTouchTool" set sName to get_string_variable "BTTNowPlayingInfoTitle" end tell set p to (POSIX path of ((path to application support folder from user domain) as text)) do shell script "set -- $(ls -lt /Users/conradsheehan/Library/Containers/com.apple.AMPArtworkAgent/Data/Documents/artwork/);cp ~/Library/Containers/com.apple.AMPArtworkAgent/Data/Documents/artwork/${11} ~/Library/Application\\ Support/BetterTouchTool/icover.jpg" do shell script "sips -Z 30 -o ~/Library/Application\\ Support/BetterTouchTool/cover.jpg ~/Library/Application\\ Support/BetterTouchTool/icover.jpg" set iColors to do shell script "python3 -c \"from PIL import Image og=[];vs=[];tmp=[];tmpi=[] img=Image.open('" & p & "BetterTouchTool/cover.jpg', 'r').convert('RGB').getcolors(maxcolors=99999) for i in img: for u in range(i[0]): og.append(i[1]) vs.append(i[1]) dict = {} count, itm = 0, '' for item in reversed(og): dict[item] = dict.get(item, 0) + 1 if dict[item] >= count : count, itm = dict[item], item ur=itm for i in og: if abs(i[0]-ur[0]) < 100: if abs(i[1]-ur[1]) < 100: if abs(i[2]-ur[2]) < 100: vs.remove(i) if len(vs)!=0: for i in vs: tmp.append((round(i[0]/2,-1)*2,round(i[1]/2,-1)*2,round(i[2]/2,-1)*2)) dict = {} count, itm = 0, '' for item in reversed(tmp): dict[item] = dict.get(item, 0) + 1 if dict[item] >= count : count, itm = dict[item], item a=itm for i in range(len(tmp)): if tmp[i]==a: tmpi.append(i) for i in reversed(range(len(vs))): if i not in tmpi: vs.remove(vs[i]) vs=[[vs[j][i] for j in range(len(vs))] for i in range(len(vs[0]))] l=len(vs[0]) a=(sum(vs[0])/l,sum(vs[1])/l,sum(vs[2])/l) else: a=(75,75,75) print(str(ur[0])+','+str(ur[1])+','+str(ur[2])) print(str(round(a[0]))+','+str(round(a[1]))+','+str(round(a[2]))) \"" set f to alias (((path to application support folder from user domain) as text) & "BetterTouchTool:color.txt") set a to open for access f with write permission set eof of a to 0 write "{\"font_color\":\"" & (paragraph 2 of iColors) & ",255\",\"background_color\":\"" & (paragraph 1 of iColors) & ",255\"}" to a close access a do shell script "rm ~/Library/Containers/com.apple.AMPArtworkAgent/Data/Documents/artwork/*" return "{\"text\":\"" & sName & "\",\"font_color\":\"" & (paragraph 2 of iColors) & ",255\",\"icon_path\":\"" & p & "BetterTouchTool/icover.jpg\",\"background_color\":\"" & (paragraph 1 of iColors) & ",255\"}"