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