Touchbar Lyric

Reference official documentation: https://github.com/ChenghaoMou/touchbar-lyric

Install Python

The installation process won't be detailed here, you can use tools like brew, python.org official website, pyenv, conda, etc. for installation.

⚠️ Issues to note:

  • Python versions 3.9.x and 3.10.x will output error messages in the widget:
1
NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'
  • Solution: The final version used is 3.12.0

Install touchbar_lyric

1
pip3 install touchbar_lyric --upgrade

Test touchbar_lyric

1
python3 -m touchbar_lyric --app Music

Configure in BetterTouchTool

  1. Customize the menu bar, select Shell Script / Task widget

  1. Fill in the script configuration:
  • Launch Path: /bin/bash
  • Parameters: -c
  • Environment Variables: Run echo $PATH in your local Terminal, then copy the output here, the format should be similar to:
    1
    PATH=/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin...

Personalization (Optional)

Display "No Lyric" when lyrics are empty

1
2
3
4
5
6
output=$(python3 -m touchbar_lyric --app Music)
if [ -z "$output" ]; then
echo "No Lyric"
else
echo "$output"
fi