  We analyze the lateral critical Casimir force acting between two planar,
chemically inhomogeneous walls confining an infinite 2D Ising strip of width
$M$. The inhomogeneity of each of the walls has size $N_1$; they are shifted by
the distance $L$ along the strip. Using the exact diagonalization of the
transfer matrix, we calculate the lateral critical Casimir force and discuss
its properties, in particular its scaling close to the 2D bulk critical point,
as a function of temperature, surface magnetic field, and the geometric
parameters $M$, $N_1$, $L$. We determine the magnetization profiles which
display the formation of the bridge joining the inhomogeneities on the walls
and establish the relation between the characteristic properties of the lateral
Casimir force and magnetization morphologies. We check numerically that
breaking of the bridge is related to the inflection point of the lateral force.
