Let $G$ be a compact Lie group with Haar measure $dg$ and (finite-dimensional real) Lie algebra $\frak g$. Endow $\frak g$ with an $\hbox{Ad}$-invariant norm $\|\cdot\|\_{\frak g}$ so that $\frak g$ becomes a normed space (one can use the norm induced by the negative of the Killing form).


Define the function
$$
f:{\frak g}\to{\frak g},~~x\mapsto\int\_Ggxg^{-1}dg,
$$
where the integral is the Bochner integral associated with the norm $\|\cdot\|\_{\frak g}$.


$f(x)$ exists for each $x\in\frak g$ because the norm of the integrand is bounded:
$$
\|gxg^{-1}\|\_{\frak g}=\|\hbox{Ad}\_gx\|\_{\frak g}=\|x\|\_{\frak g}.
$$
$f$ is $\hbox{Ad}$-invariant because $f(gxg^{-1})=f(x)$ for all $x\in\frak g$ and $g\in G$. Finally, some direct calculations using explicit parametrizations of $G$ and $\frak g$ show that $f$ is identically zero for certain groups $G$ and nonzero for others.


My questions are thus the following:


1) Can we find a general class of compact Lie groups $G$ such that $f$ is identically zero, or nonzero?


2) Is $f$ identically zero for all semisimple compact Lie groups G?


(maybe some Weyl integration formula or some argument based on Casimir functions can be used, but I have not been able to do it...)


Thank you for the help!



When this Ad-invariant function on a Lie algebra is zero?
(this is an edit made after user65432 caught me assuming implicitly that $G$ is connected.)


In case $G$ is connected, 
$f=0$ iff $\mathfrak{g}$ has no center.
In the general case, $G/G^0$ acts on the center $\mathfrak{z}<\mathfrak{g}$ and $f=0$ iff there are no invariant vectors for this action ($G^0$ denotes here the connected component of $G$).


An example for the latter case is $G=\{-1,1\}\ltimes S^1$, where $f=0$ though $\mathfrak{g}$ has a one dimensional center.


The proof is standard:


For every finite dimensional representation $\rho\colon G\to \text{GL}(V)$, $f(v)=\int \rho(g)vdg$ gives a linear operator on $V$ which is the projection on the subspace of invariants $V^G$ (clearly the image of $f$ consists of invariant vectors and $f$ is the identity on invariant vectors). 


Specializing to $\rho=\text{Ad}$ and noting that $\mathfrak{z}=\mathfrak{g}^{G^0}$ gives the answer.


