xgb os.Getenv("DISPLAY")

219 views
Skip to first unread message

abiosoft

unread,
Dec 21, 2009, 9:14:38 AM12/21/09
to golang-nuts
I tried the example.go in xgb package but I discovered that DISPLAY is
not set in my environment variables.

so os.Getenv("DISPLAY") returns empty string.

Is there a value I can used directly or how can I go about it.

Qtvali

unread,
Dec 21, 2009, 9:35:19 AM12/21/09
to golang-nuts
0:0 or something ...search that unix variable, it must point to your
local X server. It's somewhere in specs/manuals of X.

msw

unread,
Dec 21, 2009, 10:08:41 AM12/21/09
to golang-nuts
The local display is ":0" per http://manpages.ubuntu.com/manpages/karmic/en/man7/X.7.html#toptoc4
which has been my understanding since 1985.

You can also use ":0.0" but that's redundant. Oddly, neither
"localhost:0" or "my.machine.name:0" work, likely due to some X
authentication protocol which I don't feel like investigating.

An interesting question is how you got an empty DISPLAY. You should
probably look into that.

abiosoft

unread,
Dec 21, 2009, 12:38:22 PM12/21/09
to golang-nuts
my os.GetEnv("DISPLAY") now returns :0.0 but it still display the
error "cannot connect : dial tcp :6000 " during runtime.

Is there anyone that has used the package successfully? If yes, please
how did you go about it.

atomly

unread,
Dec 21, 2009, 3:13:15 PM12/21/09
to abiosoft, golang-nuts
Are you running X?
--
:: atomly ::

[ ato...@atomly.com : www.atomly.com  : http://blog.atomly.com/ ...
[ atomiq records : new york city : +1.917.442.9450 ...
[ e-mail atomly-new...@atomly.com for atomly info and updates ...

Tor

unread,
Dec 21, 2009, 4:02:46 PM12/21/09
to golang-nuts
Many X11 servers these days don't listen to TCP by default.
Try the unix domain socket, usually:

/tmp/.X11-unix/X0

abiosoft

unread,
Dec 22, 2009, 4:57:46 AM12/22/09
to golang-nuts
Thanks, the unix socket works but runtime error still occurs.
I think there is something wrong with the package.

I'll go for the mattn-go-gtk. I only wanted to give xgb a try cos its
now official.

Kenji Okamoto

unread,
Jan 14, 2010, 10:18:48 PM1/14/10
to golan...@googlegroups.com
> Thanks, the unix socket works but runtime error still occurs.
> I think there is something wrong with the package.

I'm using Debian lenny with gdm, which is the cause of problem here.
Gdm dispatches Xserver as
/usr/X11R6/bin/X :0 -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp v7.

the options -auth and -nolisten make problem for xgb package here, ie.
if you can dispatch Xserver like
/usr/X11R6/bin/X :0 -audit 0,
then you'll get success.

For this to get,
(1) as a super user, /etc/ionit.d/gdm stop☺
(2) login as usual cui console
(3) edit .xserverrc to delete the problematic option, and just lines of
-------
#!/bin/sh
exec /usr/X11R6/bin/X.
--------
Here you'll get xgd working.

However, these are just test purpose procedure, I think.
If you want to delete -nolisten tcp option permanent, you can edit
/usr/share/gdm/°fault.gdm, and change a line
DisallowTCP=true
to
DisallowTCP=false.

However, I don't know how to eliminate or change -auth /var/lib/gdm/:0.Xauth
option from gdm setting.
Anyone knows?

Kenji

Kenji Okamoto

unread,
Jan 14, 2010, 10:25:51 PM1/14/10
to golan...@googlegroups.com
> (3) edit .xserverrc to delete the problematic option, and just lines of
> -------
> #!/bin/sh
> exec /usr/X11R6/bin/X.
> --------

I forgot (4)
(4) then startx☺

Kenji

frm

unread,
Jan 15, 2010, 12:18:31 AM1/15/10
to golang-nuts
I've fixed some bugs in XGB, see http://codereview.appspot.com/183111/show.

Kenji Okamoto

unread,
Jan 15, 2010, 1:23:03 AM1/15/10
to golan...@googlegroups.com
> I've fixed some bugs in XGB, see http://codereview.appspot.com/183111/show.

I've read it.
Adding auth mechanism looks good advance to me.

When the changes will be included in the distribution?

I'm reading mails on Plan 9 machine, which has no Go source tree...
Reading diff is not good to me then.☺

Kenji

frm

unread,
Jan 15, 2010, 1:52:14 AM1/15/10
to golang-nuts
I'm also waiting for the reviewer to approve my code.

On Jan 15, 1:23 pm, Kenji Okamoto <okam...@granite.las.osakafu-
u.ac.jp> wrote:
> > I've fixed some bugs in XGB, seehttp://codereview.appspot.com/183111/show.

Reply all
Reply to author
Forward
0 new messages