I would like to make a shell script and an Applescript script to fire an X environment command when this environment is active ( through XQuartz for example ). But not just upon starting the X environment ( which is straight forward ).
To achieve this I need the value of the X environment variable:
${DISPLAY}
I thought that an easy method would be to store this value in a ${HOME}/.display
file from a ${HOME}/.xinitrc
and remove this file on exit ( trap or sequential execution ).
Is there any "good", "experimented", clean and safe method to get this value outside of the X environment?