4

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

 1 year ago
source link: https://loli.fj.cn/2023/08/10/MacOS%E9%80%9A%E8%BF%87BitBar%E5%AE%9E%E7%8E%B0%E8%87%AA%E5%AE%9A%E4%B9%89%E8%8F%9C%E5%8D%95%E6%A0%8F%E7%A8%8B%E5%BA%8F/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

MacOS 通过 BitBar 实现自定义菜单栏程序

安装 BitBar

brew install bitbar
  • 首次打开 bitbar 会提示设置一个路径作为存放脚本文件的根目录作为插件目录
01.png
  • 在插件目录创建一个脚本文件

date:脚本名作为文件名
1s:脚本刷新时间间隔

s:秒
m:分钟
h:小时
d:天

touch date.1s.sh
  • 编辑脚本内容

本案例以显示时间为例

date.1s.sh

#!/bin/zsh

echo $(date "+%Y-%m-%d %H:%M:%S")
  • 添加可执行权限
chmod +x date.1s.sh
  • Refresh all 手动刷新
02.png
03.png

输出多行的脚本

  • 输出多行的文本,除了第一行会显示在菜单栏,其他的行都会按顺序显示在子菜单内
04.png

同时运行多个脚本文件

  • 在插件目录下如果包含多个脚本文件,则每个脚本文件的第一行输出都会显示在菜单栏上

官方文档


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK