1 2 3 4 5 6 7 8 9
#!/bin/sh set -x for sock in /tmp/.X11-unix/X*; do if [[ -e /run/Xauthority.${sock##*/X} ]]; then env XAUTHORITY=/run/Xauthority.${sock##*/X} DISPLAY=:${sock##*/X} xkb else DISPLAY=:${sock##*/X} xkb fi done