make applyLoginState work in inactive window