[Techtalk] Accessing X program from virtual console
Almut Behrens
almut-behrens at gmx.net
Sat Oct 1 07:55:42 EST 2005
On Fri, Sep 30, 2005 at 09:03:37PM +0100, David Sumbler wrote:
> I tend to use virtual consoles (i.e. not running under X) for much of
> what I do - in particular, e-mail. But I use Firefox as my main
> web-browser.
>
> There is a bash script on the Firefox site, which opens a URL in a new
> tab if the URL is given as an argument. The script reads:
>
> /usr/bin/firefox -a firefox -remote "openURL($@,new-tab)" || exec /usr/bin/firefox "$@";
>
> This works fine from a terminal running under X, but if I use it from
> a virtual console, it tries to run a new instance of Firefox (I
> think), and I get (with varying process numbers, of course):
>
> "(firefox-bin:6854): Gtk-WARNING **: cannot open display:"
>
> If I insert '--display=:0' to the script line, I then get:
>
> "Error: Failed to connect to X server."
Apparently, firefox doesn't handle the option '--display' properly
(actually, in the docs I don't see any indication that it should --
though I might not have looked carefully enough...).
Anyhow, for me it works if I set the usual DISPLAY environment
variable (which is typically not set in a virtual console).
I.e. simply put the following additional line in the script
export DISPLAY=:0
/usr/bin/firefox ... ...
(If ':0' doesn't work, you might also try 'unix:0' (for unix domain
socket instead of TCP connections to X) -- though normally, this should
automatically be handled the correct way by Xlib...)
Cheers,
Almut
More information about the Techtalk
mailing list