Fix python-switching window behaviour