fixes incorrect active window detection

Fixes issue https://github.com/milkypostman/powerline/issues/37

I've been using this fix for a few weeks and it worked flawlessly so far. 
However I believe different people with different workflow should test it out prior to merging.

Regards,
Louis Kottmann