0
我希望我的控制台在终端没有看到任务完成时发出嘟嘟声。如何获得OSX中的活动(聚焦)窗口?
其实,我这一切在Linux中摸索出:
function beeper_preexec {
focus_window=`xdotool getwindowfocus`
}
function beeper_precmd {
retval=$?
if [[ $focus_window -ne `xdotool getwindowfocus` ]]; then
if [[ $retval -ne 0 ]]; then
beep -f 329.6
else
beep
fi
fi
}
function beeper_setup {
add-zsh-hook precmd beeper_precmd
add-zsh-hook preexec beeper_preexec
}
有谁知道的东西,我可以使用在OS X上取代xdotool getwindowfocus
?我不关心它是否返回PID或窗口ID,只需在焦点窗口切换时更改。
谢谢,我没有考虑到的AppleScript作为一个选项,这应该工作不够好。 – ABentSpoon