Estimate the integral $$\frac{1}{2\pi i}\int_C\frac{-e^{-z}+1}{1+ze^{-z}-\pi}\,\mathrm{d}z$$ where the curve $C$ is arbitrary curve in the right half plane $\mathrm{Re}(z)>0$ (for simplicity, we can suppose $C$ to be the square, that is, the boundary of $$\{z;\epsilon\leq\mathrm{Re}(z)\leq K ~~\text{and}~~-M\leq\mathrm{Im}(z)\leq M\}$$ I will explain why I can do this later).
My expectation is $$0<\left|\frac{1}{2\pi i}\int\frac{-e^{-z}+1}{1+ze^{-z}-\pi}\,\mathrm{d}z\right|\leq 1$$ But I got stuck on this estimate. The original question is to prove
The equation $e^{-z}+z=\pi$ has exactly one solution in the right half plane $\mathrm{Re}(z)>0$.
It is natural to try to use the zero-counting integral. And the integral $$\frac{1}{2\pi i}\int_C\frac{-e^{-z}+1}{1+ze^{-z}-\pi}\,\mathrm{d}z$$ is the number of zeros since $e^{-z}+z-\pi$ is an entire function which implies it has no singularities.
It is hard to compute the integral (at least for me) so I try to estimate the integral instead.
And it is enough to show the integral is strictly greater than $0$ and strictly less than $2$ since the integral is always an integer.
I will tackle your original problem.
Denote $C_R$ as the big semicircle with arc lying on right-half plane, centered at origin. Then for sufficiently big $R$, we have, for $z$ on $C_R$,
$$|e^{-z}|\leq 1 < |z-\pi|$$
The result immidiately follows (Rouche's theorem).