Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Set X11 authority file hostname via a script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Set X11 authority file hostname via a script
Authored by: Fletch on Apr 28, '04 10:47:25AM

You could of course just use xauth itself to modify the file rather than mucking with its data.


#!/bin/zsh
cookie=( $( xauth list | grep localhost | awk '{ print $2, $3 }' ) )

if [[ -z "$cookie" ]] ; then 
  print "No xauth data available for localhost; X11.app not running?"
  exit 1
fi

newname=$( hostname )

if [[ $# -eq 1 ]] ; then
  newname="$1" ; shift
fi

for i in ":0" "/unix:0" ; do
  xauth add "${newname}${i}" $cookie
done

exit 0


[ Reply to This | # ]