Added in 1.9.3

$lactivewid

Returns window id of the last active window.