Move writing of ~/.sx.cfg out of UI loop