原本想找一个Notifier用来提示terminal状态的软件,只是除了growl
以外,彷佛没有一个好的方案,直到偶然间看到了terminal-notifier
。git
> terminal-notifier is a command-line tool to send Mac OS X User Notifications, which are available in Mac OS X 10.8 and higher.github
Terminal Notifier 是一个命令行工具用来当Mac OS X的用户提醒。谁让Growl
是收费的,尚未试用。shell
Terminal Notifier下载地址bash
https://github.com/alloy/terminal-notifier/releasesapp
若是是用Ruby
的话能够这样安装工具
gem install terminal-notifier
只是相对于用gem这类,须要rvm
之类的来讲,Homebrew
会是一个更好的方案google
brew install terminal-notifier
Terminal Notifier用法spa
$ terminal-notifier -[message|group|list] [VALUE|ID|ID] [options]
官方给了几个示例命令行
$ echo 'Piped Message Data!' | terminal-notifier -sound default$ terminal-notifier -title '💰' -message 'Check your Apple stock!' -open 'http://finance.yahoo.com/q?s=AAPL'$ terminal-notifier -group 'address-book-sync' -title 'Address Book Sync' -subtitle 'Finished' -message 'Imported 42 contacts.' -activate 'com.apple.AddressBook'
至于 '💰' 这个神奇的符号是Mac OS专用的,其余的可能看不到。code
因而就有了这样一个本身的配置。
terminal-notifier -sound default -title '' -message "Happy Hacking!!"
至于这个苹果的起源。。听说能够用快捷键Alt + Shift + K
,至于Happy Hacking
这个写法是来自于emacs
的,
修改.bash_profile
function growl() { terminal-notifier -activate com.googlecode.iterm2 -title '' -subtitle "A message from your shell:" -message "$@"}
下面这个是用于语音提醒
function groooowl() { terminal-notifier -activate com.googlecode.iterm2 -title '' -subtitle "A message from your shell:" -message "$@" say "$@"}