$\DeclareMathOperator\supp{supp}$Let $X$ be a Cantor space, and let $S$ be a finite nonabelian simple group (or more generally a nontrivial group in which every nontrivial conjugacy class has a trivial centralizer, e.g., the symmetric group $S_n$ for $n\ge 5$). Let $G=C(X,S)$ be the group of continuous functions $C\to S$ ($S$ being viewed as discrete group). Then
(Note that if $G$$S$ is countable, hence not a infinite productso is $G$.)
One needsI claim that every nontrivial direct factor of $G$ is isomorphic to $G$ (and hence decomposable). To see this, I check that every direct product decomposition $G=A\times B$ is induced by a finite clopen partition of the Cantor set, i.e., for some clopen partition $X=Y\sqcup Z$, one has $A=C(Y,S)$ and $B=C(Z,S)$. (Thus, $G$ is nontrivial, decomposable, and every nontrivial direct factor of $G$ is isomorphic to $G$ and hence decomposable as well.)
Lemma (immediate): for $g\in G_S$, the centralizer of the conjugacy class $c_g$ of $g$ — this is where the set ofassumption on $h$ with support disjoint from$S$ is used): $g$.for $g\in G_S$, the centralizer of the conjugacy class $c_g$ of $g$ is the set of $h$ with support disjoint from $g$.
Consider the supports of elements of $A\cup B$. They form a clopen covering of $K$. By compactness, one can extract a finite covering. Noting that supports of elements of $A$ and $B$ are disjoint (by the lemma), we obtain a finite covering of $X$ of the form $X=\bigcup_{i\in I}\supp(a_i)\sqcup \bigcup_{j\in J}\supp(b_j)$, with $a_i\in A$, $b_j\in B$, and $I$, $J$ finite. Write $Y=\bigcup_{i\in I}\supp(a_i)$, $Z=\bigcup_{j\in J}\supp(b_j)$. If $b\in B$, then for every $i$, $b$ centralizes $c_{a_i}$, and hence, by the lemma, $\supp(b)\cap\supp(a_i)$ is empty. Since this holds for all $i$, $\supp(b)\subseteq Z$. Similarly $\supp(a)\subseteq Y$ for all $a\in A$. Hence $A\subseteq C(Y,S)$ and $B\subseteq C(Z,S)$. Since $G=A\times B$, these have to be equalities: $A=C(Y,S)$ and $B= C(Z,S)$.