我正在一个网络连接缓慢的环境中运行X。如何知道一个窗口何时变为可见?我需要等待,以便在可见窗口上执行另一个操作。
xterm -T foo &
# how to flush the display, or wait until the window is visible?
# polling the visibility would be acceptable as well
xmovewindow foo 10 20
更新:由于Jim Lewis的贡献,这里有一个快速完成任务的shell函数。
function xwait() {
while ! xwininfo -name $1|grep 'Map State: IsViewable';do sleep 1;done
}
xterm -T foo &
xwait foo
xmovewindow foo 10 20