This removes code duplication, which will be useful for a subsequent commit. Furthermore, we now don’t open X11 connections unnecessarily in some corner cases.
This makes i3-dump-log completely independent of a running i3 instance.