I am looking for examples of indecomposable rings with nontrivial idempotents. The only examples I can think of are matrix rings. Are there other examples?
A ring $R$ is indecomposable if $R$ cannot be written as $R\cong R_1\times R_2$ with non-zero $R_1$ or $R_2$. Another equivalent formulation of that is that the only central idempotents are $0$ and $1$, see e.g. the article mentioned by Frank Murphy in the comments.
So for giving an example, you just need a ring with non-central idempotents. As you noted the matrix ring $M_n(k)$ constitutes an example. Another example in the same vain is the ring $U_n(k)$ of upper triangular matrices.
As my basic examples of rings are finite dimensional $k$-algebras $A$ ($k$ a field), let me give you two remarks for this class of rings (not in full generality):
- If the field is algebraically closed, you can associate the quiver of $A$. Then $A$ is indecomposable iff the quiver of $A$ is connected. In this case, any connected quiver where there is more than one vertex gives an example: the path algebra of the quiver with idempotents being the length zero paths.
- The idempotents correspond to projective modules. Hence for an indecomposable ring, having non-trivial idempotents is equivalent to having non-free projective modules.