Added usage of scope when changing window state.

Signed-off-by: Jakob Brandsborg Ehmsen <jakobehmsen.github@gmail.com>