Granted you have 2 windows called =greeny, and the second one of those is active.

If now you call $window($active).wid, it will only return the window ID for the first =greeny window, even though the second one is active.

I need it to return the correct window ID of the active window, which isn't possible it seems to me...