【英文】MacOS通过BitBar实现自定义菜单栏程序

Introduction

Customize the menu bar program on MacOS using BitBar.

Install BitBar

1
brew install bitbar

Write Plugins

  • The first time you open BitBar, you will be prompted to set a path as the root directory for storing script files as the plugin directory.

  • Create a script file in the plugin directory.

date: The script name is used as the file name.
1s: The script refresh interval.

s: seconds
m: minutes
h: hours
d: days

1
touch date.1s.sh
  • Edit the script content.

This example uses displaying the time as an example.

date.1s.sh
1
2
3
#!/bin/zsh

echo $(date "+%Y-%m-%d %H:%M:%S")
  • Add executable permission.
1
chmod +x date.1s.sh
  • Manually refresh with Refresh all.

  • Done.

Output Multiple Lines of Script

  • When outputting multiple lines of text, except for the first line, which will be displayed in the menu bar, the other lines will be displayed in the submenu in order.

Run Multiple Script Files Simultaneously

  • If there are multiple script files in the plugin directory, the first line of each script file will be displayed in the menu bar.

Done

References

Official Documentation
Ifanr - Yan Xisha
CSDN Blog - Chanue