Let $G$ be a connected Lie group and $\Sigma$ a closed oriented surface. We know that principal $G$-bundles $P$ can be topologically classified by a characteristic class $c(P)\in H^2(\Sigma,\pi_1G)\cong\pi_1G$.

The following is my question:

Let $G$ be a semisimple connected (or even compact) Lie group, $\beta\colon\pi_1(\Sigma)\to G$ a group homomorphism, and $\Sigma$ a closed oriented surface. Consider the universal cover $\tilde{\Sigma}\to\Sigma$ which is a principal $\pi_1(\Sigma)$-bundle. Form the associated bundle $\tilde{\Sigma}\times_\beta G$ which is necessarily a principal $G$-bundle over $\Sigma$. Hence, it should have a characteristic class $c(\tilde{\Sigma}\times_\beta G)\in H^2(\Sigma,\pi_1G)\cong\pi_1G$. Is there a way to compute this characteristic class in terms of $\beta$?

The difficulty here is that $\pi_1(\Sigma)$ is not connected, and hence I cannot use the functoriality of the characteristic class. Another one is that I am not sure how to compute the induced map $B\beta\colon B\pi_1(\Sigma)\to BG$ concretely.

I've asked this question on MSE and haven't got any answers yet.