 Final solution not requiring to be root, and accessible from a non-interactive shell in a automated way :
-`XAUTHORITY` :
ps -u $(id -u) -o pid= |
xargs -I{} cat /proc/{}/environ 2>/dev/null |
tr '\0' '\n' |
grep -m1 '^XAUTHORITY='
- `DISPLAY` :
ps -u $(id -u) -o pid= |
xargs -I{} cat /proc/{}/environ 2>/dev/null |
tr '\0' '\n' |
grep -m1 '^DISPLAY=:.*$'
Based on [this](https://superuser.com/a/975536/68500)