#!/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