xChar
·a month ago

macbook的touchbar功能在新版的mac上已经没了,但个人还是挺喜欢有touchbar的mac的。可以在touchbar上显示音乐歌词。

工具

安装touchbar_lyric

pip3 install touchbar_lyric --upgrade

去touchbar_lyric项目找到lyric.json文件,内容如下,导入到BetterTouchTool中。

[
    {
      "BTTWidgetName" : "Lyric",
      "BTTTriggerType" : 642,
      "BTTTriggerTypeDescription" : "Shell Script \/ Task Widget",
      "BTTTriggerClass" : "BTTTriggerTypeTouchBar",
      "BTTPredefinedActionType" : -1,
      "BTTPredefinedActionName" : "No Action",
      "BTTShellScriptWidgetGestureConfig" : "\/bin\/sh:::-c:::-:::",
      "BTTEnabled2" : 1,
      "BTTRepeatDelay" : 0,
      "BTTUUID" : "93C8B565-73C7-49BE-960A-4FCF512CE881",
      "BTTNotesInsteadOfDescription" : 0,
      "BTTEnabled" : 1,
      "BTTModifierMode" : 0,
      "BTTOrder" : 0,
      "BTTDisplayOrder" : 99,
      "BTTMergeIntoTouchBarGroups" : 0,
      "BTTTriggerConfig" : {
        "BTTTouchBarFreeSpaceAfterButton" : 0,
        "BTTTouchBarOnlyShowIcon" : false,
        "BTTTouchBarButtonColor" : "0.000000, 0.000000, 0.000000, 255.000000",
        "BTTTouchBarApplyCornerRadiusTo" : 0,
        "BTTTouchBarItemPlacement" : 0,
        "BTTTouchBarAppleScriptStringRunOnInit" : true,
        "BTTTouchBarAlwaysShowButton" : false,
        "BTTTouchBarFontColorAlternate" : "0.000000, 0.000000, 0.000000, 255.000000",
        "BTTScriptType" : 0,
        "BTTTouchBarButtonWidth" : 550,
        "BTTTouchBarScriptUpdateInterval" : 1,
        "BTTTouchBarItemIconHeight" : 22,
        "BTTTouchBarButtonUseFixedWidth" : 0,
        "BTTTouchBarButtonTextAlignment" : 1,
        "BTTTouchBarAlternateBackgroundColor" : "0.000000, 0.000000, 0.000000, 255.000000",
        "BTTTBWidgetWidth" : 400,
        "BTTTouchBarItemIconWidth" : 22,
        "BTTTouchBarShellScriptString" : "$PYTHONPATH -m touchbar_lyric  --app Spotify",
        "BTTTouchBarIconTextOffset" : 5,
        "BTTTouchBarButtonFontSize" : 12,
        "BTTTouchBarFontColor" : "156.000006, 226.000002, 90.000002, 255.000000",
        "BTTTouchBarButtonName" : "Lyric",
        "BTTTouchBarButtonCornerRadius" : 6,
        "BTTTouchBarItemPadding" : 20
      }
    }
  ]

下载lyric.json文件,在BetterTouchTool中导入预设。

f1fcc14443b78250156d5c937ca3b059_MD5

ee7383b9944796fde2b2aaf8afe5e0a3_MD5

新建一个触发器,选择Shell脚本/任务 Widget,小部件标识符写个名称,在下面4中写入,/opt/homebrew/Cellar/[email protected]/3.9.19/bin/python3.9 -m touchbar_lyric --app Spotify --traditional,这段脚本,在touchbar_lyric中可以找到。

780897552ed506909ee994723e3fe674_MD5

如何判断python3的位置呢?

b58f1e8248e06796261f3b93b8f8227e_MD5

后续重启BetterTouchTool即可实现touch bar中显示歌词。

Loading comments...