format detection: simplify code, handle "sh" processes in the hierarchy
i3 starts processes using /bin/sh now, not $SHELL. This increases the
likelihood with which we are started by dash, which tends to leave its
processes in the hierarchy, e.g.:
michael 1524 i3bar --bar_id=bar-0 --socket=/run/user/1000/i3/ipc-s
michael 1525 \_ /bin/sh -c i3status
michael 1526 \_ i3status
This case is now handled correctly — when the parent is “sh”, the parent
of sh will be used instead.