#!/bin/sh set -x for sock in /tmp/.X11-unix/X*; do if test -e "/run/Xauthority.${sock##*/X}"; then env XAUTHORITY="/run/Xauthority.${sock##*/X}" DISPLAY=":${sock##*/X}" "$@" else DISPLAY=":${sock##*/X}" "$@" fi done