extract external monitor handling from xinitrc into standalone script